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; }
public override StrategyChoice Step(StrategyChoice inputChoice) { var retValue = StrategyChoice.Cooperate; if (inputChoice == StrategyChoice.Cooperate) { retValue = StrategyChoice.Defect; } return(retValue); }
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; } } }
public override StrategyChoice Step(StrategyChoice inputChoice) { return StrategyChoice.Cooperate; }
public override StrategyChoice Step(StrategyChoice inputChoice) { return (StrategyChoice)rng.Next(0, 2); }
/// <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"); }
public abstract StrategyChoice Step(StrategyChoice inputChoice);
public override StrategyChoice Step(StrategyChoice inputChoice) { return StrategyChoice.Defect; }
public override StrategyChoice Step(StrategyChoice inputChoice) { return(StrategyChoice.Cooperate); }
public override StrategyChoice Step(StrategyChoice inputChoice) { return inputChoice; }
public override StrategyChoice Step(StrategyChoice inputChoice) { return(StrategyChoice.Defect); }