static SettlerBoardConstructor() { _originalList = new DegreeCount(); _originalList[DegreeType.Grain] = 4; _originalList[DegreeType.Wood] = 4; _originalList[DegreeType.Brick] = 3; _originalList[DegreeType.Ore] = 3; _originalList[DegreeType.Sheep] = 4; }
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; }
private DegreeCount ParseStudents(string str) { IEnumerable<Tuple<DegreeType, int>> degrees = str.Split(',').Select(s => ParseStudent(s.Trim())); var count = new DegreeCount(); foreach (var degree in degrees) { count[degree.Item1] += degree.Item2; } return count; }
private DegreeCount[] Enrol(int hexID) { var array = new DegreeCount[NumberOfUniversities]; int index, number; foreach (var hex in Board[hexID]) { foreach (var vertex in hex.Adjacent.Vertices) { if (vertex.Campus != null) { var uni = _color2University[vertex.Campus.Color]; index = uni.PlayerIndex; number = (vertex.Campus.Type == CampusType.Traditional) ? 1 : 2; if (array[index] == null) { array[index] = new DegreeCount(); } array[index][hex.Degree] += number; uni.EnrolStudents(hex.Degree, number); } } } return array; }
internal void Reset() { InternetLinks = new HashSet<IEdge>(); Campuses = new HashSet<IVertex>(); SuperCampuses = new HashSet<IVertex>(); SpecialSites = new HashSet<ISpecialTradingSite>(); _normalSiteLocations = new HashSet<IVertex>(); Students = new DegreeCount(); ProductionChances = new DegreeCount(); ResetStudentCounts(); NumberOfSuccessfulCompanies = 0; NumberOfFailedCompanies = 0; _generalTradingRate = GameConstants.NormalTradingStudentQuantity; }
internal void RemoveExtraStudents(DegreeCount roll) { if (roll == null) return; foreach (DegreeType degree in roll.Keys) { Students[degree] -= roll[degree]; } }