Beispiel #1
0
        public void Initialize()
        {
            var contestant1 = new Contestant("Nice",new Nice());
              var contestant2 = new Contestant("Mean",new Mean());

              pd = new PrisonersDilemma(contestant1, contestant2);
        }
Beispiel #2
0
        public void NiceVSNiceTest()
        {
            var contestant1 = new Contestant("Nice", new Nice());
              var contestant2 = new Contestant("Nice2", new Nice());

              pd = new PrisonersDilemma(contestant1, contestant2);

              var result = pd.Step();
              Assert.AreEqual("C,C 1,1 1,1", result);

              result = pd.Step();
              Assert.AreEqual("C,C 1,1 2,2", result);

              result = pd.Step();
              Assert.AreEqual("C,C 1,1 3,3", result);

              result = pd.Step();
              Assert.AreEqual("C,C 1,1 4,4", result);
        }
Beispiel #3
0
        private static void RunPrisonersDilemma()
        {
            var contestant1 =
              //new Contestant("Nice", new Nice());
              //new Contestant("mean", new Mean());
              new Contestant("titfortat", new TitForTat());
              //new Contestant("RNG", new RandomChoice());

              var contestant2 =
              //new Contestant("Mean", new Mean());
              //new Contestant("nice", new Nice());
              //new Contestant("titfortat", new TitForTat());
              new Contestant("RNG", new RandomChoice());

              var pd = new PrisonersDilemma(contestant1, contestant2);

              Console.WriteLine(pd.ShowContestants());

              for (int i = 1; i < 40; i++) {
            Console.WriteLine(pd.Step());
              }
        }