diff --git a/inf3.csproj b/inf3.csproj index ecd81fb..22ec838 100644 --- a/inf3.csproj +++ b/inf3.csproj @@ -57,10 +57,13 @@ + + + @@ -138,4 +141,4 @@ - + \ No newline at end of file diff --git a/src/EnumDecision.cs b/src/EnumDecision.cs index 1d71fcd..56b236f 100644 --- a/src/EnumDecision.cs +++ b/src/EnumDecision.cs @@ -4,7 +4,7 @@ namespace WorldOfPeacecraft { public enum Decision { - DRAGON, STAGHUNT, SKIRMISH + FIGHT, REST, STAG, BUNNY, SWORD, ALCHEMY, MAGIC } } diff --git a/src/GameStrategy.cs b/src/GameStrategy.cs index 842915d..93c5058 100644 --- a/src/GameStrategy.cs +++ b/src/GameStrategy.cs @@ -3,40 +3,40 @@ using System.Collections.Generic; using System.Linq; using System.Text; -namespace inf3.src +namespace WorldOfPeacecraft { class GameStrategy { - // 0 = defect, 1 = cooperate - int opponentLastMove; - bool opDefected = false; + int counter = 0; - public GameStrategy(int opLM) + public GameStrategy() { - opponentLastMove = opLM; } - public int nextMove() + public bool getFirstMove() { - if (opponentLastMove != 0) + return true; + } + + public bool nextMove(bool opCooperated) + { + if (opCooperated && counter==0) { - return opponentLastMove; + return true; } else { - opDefected = true; counter++; if (counter < 10) { - return 0; + return false; } else { counter = 0; - opDefected = false; - return 0; + return false; } } diff --git a/src/IGame.cs b/src/IGame.cs new file mode 100644 index 0000000..3c84cd3 --- /dev/null +++ b/src/IGame.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace WorldOfPeacecraft +{ + public interface IGame + { + Decision getFirstMove(); + Decision getNextMove(Decision opLM); + } +} diff --git a/src/Skirmish.cs b/src/Skirmish.cs new file mode 100644 index 0000000..1a7be41 --- /dev/null +++ b/src/Skirmish.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace WorldOfPeacecraft +{ + class Skirmish + { + Random random = new Random(); + + public Skirmish() + { + } + + public Decision getFirstMove() + { + return getNextMove(); + } + + public Decision getNextMove() + { + int randomNumber = random.Next(0, 2); + Decision bla; + switch (randomNumber) + { + case 0: + bla = Decision.SWORD; + break; + case 1: + bla = Decision.MAGIC; + break; + case 2: + default: + bla = Decision.ALCHEMY; + break; + } + return bla; + } + } +}