コード例 #1
0
 private int CalculateAdvantage(Plan plan)
 {
     IDictionary<IPlayer, int> scores = GameState.Players.ToDictionary(p => p, p => GameState.PlayerScore(p)+plan.Worth(p));
     if (scores[Player]>scores.Where(kvp => kvp.Key != Player).Max(kvp => kvp.Value))
         return scores.Where(kvp => kvp.Key != Player).Sum(kvp => scores[Player]-kvp.Value);
     return scores.Where(kvp => kvp.Key != Player && kvp.Value>scores[Player]).Sum(kvp => scores[Player]-kvp.Value);
 }