internal override bool HasCompletedTeamBonus(PublicBoard board) { Dictionary <Restaurant, int> majorities = new Dictionary <Restaurant, int>(); foreach (Restaurant restaurant in Extensions.Restaurants) { majorities.Add(restaurant, 0); } foreach (DayOfWeek day in Extensions.Weekdays) { if (board.HasMajority(day)) { majorities[board.RestaurantWithMajority(day).Value]++; } } return(majorities.Values.All(x => x <= 1)); }
internal override bool HasCompletedTeamBonus(PublicBoard board) { foreach (DayOfWeek day in Extensions.Weekdays) { foreach (Restaurant restaurant in Extensions.Restaurants) { if (board.Restaurants[restaurant].Menu.Contains(FoodType.Vegetarian) && board.RestaurantWithMajority(day) == restaurant) { return(false); } } } return(true); }
protected override PreferenceHistogram GetPreferenceHistogram(PublicBoard board, int i, IEnumerable <PreferenceHistogram> last) { PreferenceHistogram preferenceHistogram = new PreferenceHistogram(board); foreach (Restaurant restaurant in Extensions.Restaurants.Scramble()) { RestaurantPlace r = board.Restaurants[restaurant]; RestaurantDailyModifierCard modifier = r.Modifier; if (modifier is OneVictoryPointBonus && modifier.Days.Contains(board.CurrentWeekDay)) { preferenceHistogram.Preferences[r] += 10; } if (modifier is OneTeamPointIfMajority && modifier.Days.Contains(board.CurrentWeekDay)) { preferenceHistogram.Preferences[r] += 20; } if (modifier is OneDollarDiscount && modifier.Days.Contains(board.CurrentWeekDay)) { preferenceHistogram.Preferences[r] += 10; } if (modifier is DoesNotAdvanceTrackPlus2VictoryPoints && modifier.Days.Contains(board.CurrentWeekDay)) { preferenceHistogram.Preferences[r] += 20; } if (this._prefCards.First().FirstPreference == restaurant) { preferenceHistogram.Preferences[r] += 40; } if (this._prefCards.First().SecondPreference == restaurant) { preferenceHistogram.Preferences[r] += 20; } if (this._prefCards.First().Undesired == restaurant) { preferenceHistogram.Preferences[r] /= 2; if (board.CurrentTeamBonus is WentOnceToUndesired) { preferenceHistogram.Preferences[r] += 20; } } if (modifier is OneDollarIncrease && modifier.Days.Contains(board.CurrentWeekDay)) { preferenceHistogram.Preferences[r] /= 2; } foreach (FoodType food in _foodCards.Select(x => x.Type).Distinct()) { if (r.Menu.Contains(food)) { preferenceHistogram.Preferences[r] += 10; } } if (this._loyaltyCards.First().Restaurant == restaurant) { preferenceHistogram.Preferences[r] += 30; } if (last != null) { foreach (PreferenceHistogram pref in last) { foreach (KeyValuePair <Place, int> histogramEntry in pref.Preferences) { preferenceHistogram.Preferences[histogramEntry.Key] += (histogramEntry.Value * i) / 10; } } } if (board.CurrentTeamBonus is AllEatBrazilianAndChineseThreeTimes) { if (r.Menu.Contains(FoodType.Brazilian) || r.Menu.Contains(FoodType.Chinese)) { preferenceHistogram.Preferences[r] += 20; } } if (board.CurrentTeamBonus is AllEatBurgerAndPizzaThreeTimes) { if (r.Menu.Contains(FoodType.Burger) || r.Menu.Contains(FoodType.Pizza)) { preferenceHistogram.Preferences[r] += 20; } } if (board.CurrentTeamBonus is AllEatAllFoodAtLeastTwice) { Dictionary <FoodType, int> foodTypes = new Dictionary <FoodType, int>(); foreach (FoodType food in Extensions.FoodTypes) { foodTypes.Add(food, 0); } foreach (DayOfWeek day in Extensions.Weekdays.Where(x => x < board.CurrentWeekDay)) { foreach (FoodType food in board.VisitedPlaces[this][day].Menu) { foodTypes[food]++; } } foreach (FoodType food in Extensions.FoodTypes) { if (foodTypes[food] < 2 && board.CurrentWeekDay > DayOfWeek.Tuesday && r.Menu.Contains(food)) { preferenceHistogram.Preferences[r] += 15; } } } if (board.CurrentTeamBonus is NoPriceIncreasedThisWeek) { if (r.Visitors.Sum(x => x.Value.Count) == board.Players.Count + 2) { preferenceHistogram.Preferences[r] /= 6; } } if (board.CurrentTeamBonus is NoMoreThan1MajorityInARestaurant) { foreach (DayOfWeek day in Extensions.Weekdays) { if (board.RestaurantWithMajority(day) == r.Identifier) { preferenceHistogram.Preferences[r] /= 4; break; } } } } foreach (Restaurant restaurant in Extensions.Restaurants.Scramble()) { RestaurantPlace r = board.Restaurants[restaurant]; RestaurantDailyModifierCard modifier = r.Modifier; int cost = r.Cost; if (modifier is OneDollarDiscount && modifier.Days.Contains(board.CurrentWeekDay)) { cost--; } if (modifier is OneDollarIncrease && modifier.Days.Contains(board.CurrentWeekDay)) { cost++; } if (cost > board.PlayerCash[this]) { preferenceHistogram.Preferences[r] = 0; } if (modifier is Closed && modifier.Days.Contains(board.CurrentWeekDay)) { preferenceHistogram.Preferences[r] = 0; } } return(preferenceHistogram.Normalize()); }