public static Decision Distribute(int influenceTowardsRock, int influenceTowardsPaper, int influenceTowardsScissors) { Decision weights = new Decision() { InfluenceTowardsRock = influenceTowardsRock, InfluenceTowardsPaper = influenceTowardsPaper, InfluenceTowardsScissors = influenceTowardsScissors }; return weights; }
public abstract Decision React(IEntityRecord opponent, Decision decision);
public void Push(Decision decision) { _decisions.Add(decision); }
public static Decision Distribute(Hand hands, int influence) { if (hands == Hand.NotSpecified) { return Decision.Undecided; } Decision decision = new Decision(); int modes = (int)hands; if ((modes & (int)Hand.Rock) == (int)Hand.Rock) { decision.InfluenceTowardsRock += influence; } if ((modes & (int)Hand.Paper) == (int)Hand.Paper) { decision.InfluenceTowardsPaper += influence; } if ((modes & (int)Hand.Scissors) == (int)Hand.Scissors) { decision.InfluenceTowardsScissors += influence; } return decision; }
public Outcome DetermineOutcome(Decision otherDecision) { Outcome outcome = Outcome.Unknown; Hand ha = MostInfluencedHand; Hand hb = otherDecision.MostInfluencedHand; if (ha == Hand.NotSpecified || hb == Hand.NotSpecified) { return outcome; } if (ha != hb) { switch (ha) { default: break; case Hand.Rock: { if (hb == Hand.Scissors) { outcome = Outcome.Win; } else if (hb == Hand.Paper) { outcome = Outcome.Loss; } } break; case Hand.Paper: { if (hb == Hand.Rock) { outcome = Outcome.Win; } else if (hb == Hand.Scissors) { outcome = Outcome.Loss; } } break; case Hand.Scissors: { if (hb == Hand.Paper) { outcome = Outcome.Win; } else if (hb == Hand.Rock) { outcome = Outcome.Loss; } } break; } } else { outcome = Outcome.Tie; } return outcome; }
public static Decision Win(Decision decision, int influence) { Hand hand = Hand.NotSpecified; switch (decision.MostInfluencedHand) { default: break; case Hand.Rock: { hand = Hand.Paper; } break; case Hand.Paper: { hand = Hand.Scissors; } break; case Hand.Scissors: { hand = Hand.Rock; } break; } return Decision.Distribute( hand, influence); }