public void Notify(Match match)
 {
     Player opp = match.GetOpponent(this);
     if (match.GetResult(opp.GetName()) == PlayResult.Defect) {
         playersWhoDefected.Add(opp.GetName());
     }
 }
 public void Notify(Match match)
 {
     Player opp = match.GetOpponent(this);
     if (playerLastAction.ContainsKey(opp.GetName())) {
         playerLastAction[opp.GetName()] = match.GetResult(opp.GetName());
     } else {
         playerLastAction.Add(opp.GetName(), match.GetResult(opp.GetName()));
     }
 }
        public void Notify(Match match)
        {
            countDown--;
            if (countDown == 0) {
                current += 2; // get next odd
                countDown = current;

                // switch strategy
                if (strategy == PlayResult.Cooperate) {
                    strategy = PlayResult.Defect;
                }

                if (strategy == PlayResult.Defect) {
                    strategy = PlayResult.Cooperate;
                }
            }
        }
        private void RecordResult(Match match)
        {
            Player player1 = match.FirstPlayer;
            Player player2 = match.SecondPlayer;

            if (!scores.ContainsKey(player1.GetName())) {
                scores[player1.GetName()] = match.GetPoints(player1.GetName());
            } else {
                scores[player1.GetName()] = (int)scores[player1.GetName()] + match.GetPoints(player1.GetName());
            }

            if (!scores.ContainsKey(player2.GetName())) {
                scores[player2.GetName()] = match.GetPoints(player2.GetName());
            } else {
                scores[player2.GetName()] = (int)scores[player2.GetName()] + match.GetPoints(player2.GetName());
            }
        }
 private void PlaySingleGame(Player player1, Player player2)
 {
     Match match = new Match(player1, player2);
     match.PlayMatch();
     RecordResult(match);
     player1.Notify(match);
     player2.Notify(match);
 }
Beispiel #6
0
 public void Notify(Match match)
 {
 }
 public void Notify(Match match)
 {
     Player opp = match.GetOpponent(this);
     lastResult[opp.GetName()] = match.GetResult(opp.GetName());
 }