diff --git a/src/GameStrategy.cs b/src/GameStrategy.cs new file mode 100644 index 0000000..842915d --- /dev/null +++ b/src/GameStrategy.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace inf3.src +{ + class GameStrategy + { + // 0 = defect, 1 = cooperate + + int opponentLastMove; + bool opDefected = false; + int counter = 0; + + public GameStrategy(int opLM) + { + opponentLastMove = opLM; + } + + public int nextMove() + { + if (opponentLastMove != 0) + { + return opponentLastMove; + } + else + { + opDefected = true; + counter++; + if (counter < 10) + { + return 0; + } + else + { + counter = 0; + opDefected = false; + return 0; + + } + } + } + + } + +}