示例#1
0
 private double GetVertexScore(IGame game, IVertex vertex)
 {
     if (!vertex.IsFreeToBuildCampus())
     {
         return 0.0;
     }
     // current production chance for uni
     var productionChances = new DegreeCount { game.CurrentIUniversity.ProductionChances };
     foreach (IHexagon hex in vertex.Adjacent.Hexagons)
     {
         productionChances[hex.Degree] += GameConstants.DiceRollNumber2Chance[hex.ProductionNumber];
     }
     double score = 0.0;
     if (game.CurrentPhase == GamePhase.Setup2)
     {
         int hasDegreeNumber = productionChances.Values.Count(v => v != 0);
         if (hasDegreeNumber == GameConstants.RealDegrees.Length)
         {
             score += _gameEvaluation.Scores.ProductionMultiplier * 3;
         }
         else if (hasDegreeNumber == GameConstants.RealDegrees.Length - 1)
         {
             score += _gameEvaluation.Scores.ProductionMultiplier;
         }
     }
     var productionScores = new Dictionary<DegreeType, double>();
     foreach (DegreeType degree in productionChances.Keys)
     {
         productionScores[degree] =
             productionChances[degree] * _gameEvaluation.Scores.ProductionMultiplier;
     }
     if (game.CurrentPhase == GamePhase.Setup1)
     {
         // amplify the production scores for a certain degree
         foreach (DegreeType degree in productionChances.Keys)
         {
             productionScores[degree] *= game.Scarcity[degree]*_gameEvaluation.Scores.SetupDegreeModifier[degree];
         }
     }
     else // Setup2
     {
         foreach (DegreeType degree in productionChances.Keys)
         {
             productionScores[degree] *= _gameEvaluation.Scores.DegreeModifier[degree];
         }
         // site score
         if (vertex.TradingSite != null)
         {
             var specialSite = vertex.TradingSite as ISpecialTradingSite;
             if (specialSite != null)
             {
                 score += productionChances[specialSite.TradeOutDegree]*
                          _gameEvaluation.Scores.SpecialSiteMultiplier;
             }
             else // normal site
             {
                 score += _gameEvaluation.Scores.NormalSite;
             }
         }
     }
     score += productionScores.Values.Sum();
     return score;
 }