Example #1
0
        public StrategyChoice Step(StrategyChoice? opponentChoice)
        {
            if (Strategy == null) throw new NullReferenceException("Strategy not set");

              LastChoice = !opponentChoice.HasValue ? Strategy.Start() : Strategy.Step(opponentChoice.Value);
              return LastChoice.Value;
        }
Example #2
0
        public override StrategyChoice Step(StrategyChoice inputChoice)
        {
            var retValue = StrategyChoice.Cooperate;

            if (inputChoice == StrategyChoice.Cooperate)
            {
                retValue = StrategyChoice.Defect;
            }

            return(retValue);
        }
Example #3
0
        private static void validateRandomChoice(StrategyChoice startStrategy, ref bool differentResult, ref RandomChoice p)
        {
            //Check one of the two valid values is found.
            //  bool foundValidValue = false;
            var x = p.Step(startStrategy);


            for (int i = 0; i < 5; i++)
            {
                p = new RandomChoice();
                var xr = p.Step(startStrategy);

                if (x != xr)
                {
                    differentResult = true;
                    break;
                }
            }
        }
Example #4
0
 public override StrategyChoice Step(StrategyChoice inputChoice)
 {
     return StrategyChoice.Cooperate;
 }
Example #5
0
 public override StrategyChoice Step(StrategyChoice inputChoice)
 {
     return (StrategyChoice)rng.Next(0, 2);
 }
Example #6
0
 /// <summary>
 /// Returns the textual description for the strategy choice.
 /// </summary>
 /// <param name="choice"></param>
 /// <returns></returns>
 public static string Display(StrategyChoice choice)
 {
     return(choice == StrategyChoice.Cooperate ? "Cooperate" : "Defect");
 }
Example #7
0
 public abstract StrategyChoice Step(StrategyChoice inputChoice);
Example #8
0
 public override StrategyChoice Step(StrategyChoice inputChoice)
 {
     return StrategyChoice.Defect;
 }
Example #9
0
 public override StrategyChoice Step(StrategyChoice inputChoice)
 {
     return (StrategyChoice)rng.Next(0, 2);
 }
Example #10
0
 public override StrategyChoice Step(StrategyChoice inputChoice)
 {
     return(StrategyChoice.Cooperate);
 }
Example #11
0
 public abstract StrategyChoice Step(StrategyChoice inputChoice);
Example #12
0
 public override StrategyChoice Step(StrategyChoice inputChoice)
 {
     return inputChoice;
 }
Example #13
0
 public override StrategyChoice Step(StrategyChoice inputChoice)
 {
     return(StrategyChoice.Defect);
 }