internal override bool HasCompletedForPlayer(PlayerBase player, PublicBoard board)
        {
            Place monday    = board.VisitedPlaces[player][DayOfWeek.Monday];
            Place tuesday   = board.VisitedPlaces[player][DayOfWeek.Tuesday];
            Place wednesday = board.VisitedPlaces[player][DayOfWeek.Wednesday];
            Place thursday  = board.VisitedPlaces[player][DayOfWeek.Thursday];
            Place friday    = board.VisitedPlaces[player][DayOfWeek.Friday];

            if (monday is RestaurantPlace && tuesday is RestaurantPlace && monday == tuesday)
            {
                return(false);
            }
            if (tuesday is RestaurantPlace && wednesday is RestaurantPlace && tuesday == wednesday)
            {
                return(false);
            }
            if (wednesday is RestaurantPlace && thursday is RestaurantPlace && wednesday == thursday)
            {
                return(false);
            }
            if (thursday is RestaurantPlace && friday is RestaurantPlace && thursday == friday)
            {
                return(false);
            }

            return(true);
        }
Exemple #2
0
        internal override bool HasCompletedTeamBonus(PublicBoard board)
        {
            Dictionary <PlayerBase, Dictionary <PlayerBase, int> > _opinion = new Dictionary <PlayerBase, Dictionary <PlayerBase, int> >();

            foreach (PlayerBase player in board.Players)
            {
                _opinion.Add(player, player.AskOpinionForDonationTeamObjective(board));
            }

            Dictionary <PlayerBase, int> _intents = new Dictionary <PlayerBase, int>();

            foreach (PlayerBase player in board.Players)
            {
                _intents.Add(player, player.AskForDonationTeamObjectiveIntent(board, _opinion));
            }

            Dictionary <PlayerBase, int> _response = new Dictionary <PlayerBase, int>();

            foreach (PlayerBase player in board.Players)
            {
                _response.Add(player, player.AskForDonationTeamObjective(board, _opinion, _intents));
            }

            while (_response.Values.Sum() > 7)
            {
                _response[_response.Where(x => x.Value == _response.Values.Max()).Scramble().First().Key]--;
            }

            return(_response.Values.Sum() >= 7);
        }
 internal override bool HasCompletedForPlayer(PlayerBase player, PublicBoard board)
 {
     foreach (Restaurant restaurant in Extensions.Restaurants)
     {
         if (board.Restaurants[restaurant].HasPlayerVisited(player, DayOfWeek.Monday) &&
             board.Restaurants[restaurant].HasPlayerVisited(player, DayOfWeek.Tuesday) &&
             board.Restaurants[restaurant].HasPlayerVisited(player, DayOfWeek.Wednesday))
         {
             return(true);
         }
         if (board.Restaurants[restaurant].HasPlayerVisited(player, DayOfWeek.Tuesday) &&
             board.Restaurants[restaurant].HasPlayerVisited(player, DayOfWeek.Wednesday) &&
             board.Restaurants[restaurant].HasPlayerVisited(player, DayOfWeek.Thursday))
         {
             return(true);
         }
         if (board.Restaurants[restaurant].HasPlayerVisited(player, DayOfWeek.Wednesday) &&
             board.Restaurants[restaurant].HasPlayerVisited(player, DayOfWeek.Thursday) &&
             board.Restaurants[restaurant].HasPlayerVisited(player, DayOfWeek.Friday))
         {
             return(true);
         }
     }
     return(false);
 }
        protected override void SignalNewWeek(PublicBoard board)
        {
            this._foodCards    = new List <FoodCard>();
            this._loyaltyCards = new List <LoyaltyCard>();
            this._prefCards    = new List <PreferenceCard>();

            EvaluateRestaurantAttractiveness(board);
        }
        protected override LoyaltyCard AskLoyalty(PublicBoard board)
        {
            Dictionary <LoyaltyCard, int> loyalties = new Dictionary <LoyaltyCard, int>();

            foreach (LoyaltyCard card in _loyaltyCards)
            {
                loyalties.Add(card, 0);
                switch (Character)
                {
                case Character.Environment:
                    if (board.Restaurants[card.Restaurant].Menu.Contains(FoodType.Vegetarian))
                    {
                        loyalties[card] += 30;
                    }
                    break;

                case Character.Intern:
                    if (card.Type == LoyaltyType.VIP)
                    {
                        loyalties[card] += 30;
                    }
                    break;

                case Character.Marketing:
                    if (card.Type == LoyaltyType.GOLD)
                    {
                        loyalties[card] += 15;
                    }
                    break;
                }

                foreach (FoodType food in FavoriteFood)
                {
                    if (board.Restaurants[card.Restaurant].Menu.Contains(food))
                    {
                        loyalties[card] += 10;
                    }
                }
                if (card.Restaurant == _chosenPreference.FirstPreference)
                {
                    loyalties[card] += 20;
                }
                if (card.Restaurant == _chosenPreference.SecondPreference)
                {
                    loyalties[card] += 10;
                }

                loyalties[card] += _attractiveness[card.Restaurant];

                if (card.Restaurant == _chosenPreference.Undesired)
                {
                    loyalties[card] = 0;
                }
            }

            return(loyalties.OrderByDescending(x => x.Value).First().Key);
        }
Exemple #6
0
 internal override bool HasCompletedTeamBonus(PublicBoard board)
 {
     foreach (DayOfWeek day in Extensions.Weekdays)
     {
         if (board.Home.Visitors[day].Count > 0)
         {
             return(false);
         }
     }
     return(true);
 }
 internal override bool HasCompletedForPlayer(PlayerBase player, PublicBoard board)
 {
     foreach (DayOfWeek day in Extensions.Weekdays)
     {
         if (board.Home.HasPlayerVisited(player, day))
         {
             return(false);
         }
     }
     return(true);
 }
        internal override bool HasCompletedForPlayer(PlayerBase player, PublicBoard board)
        {
            int majorities = 0;

            foreach (DayOfWeek day in Extensions.Weekdays)
            {
                if (board.IsPlayerInMajority(day, player))
                {
                    majorities++;
                }
            }
            return(majorities >= 3);
        }
 internal override bool HasCompletedForPlayer(PlayerBase player, PublicBoard board)
 {
     foreach (Restaurant restaurant in Extensions.Restaurants)
     {
         RestaurantTrack track       = board.RestaurantTracks[restaurant];
         int             playerScore = track.PlayerScores[player];
         if (track.PlayerScores.Values.Where(x => x >= playerScore).Count() == 1)
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #10
0
        internal override bool HasCompletedTeamBonus(PublicBoard board)
        {
            Dictionary <PlayerBase, int> status = new Dictionary <PlayerBase, int>();

            foreach (PlayerBase player in board.Players)
            {
                status.Add(player, 0);
                foreach (DayOfWeek day in Extensions.Weekdays)
                {
                    status[player] += board.IsPlayerInMajority(day, player) ? 1 : 0;
                }
            }
            return(status.Values.All(x => x >= 2));
        }
Exemple #11
0
 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);
 }
Exemple #12
0
        private int GetMenuCoverageForCards(PublicBoard board, FoodCard foodCard1, FoodCard foodCard2)
        {
            int coverage = 0;

            foreach (Restaurant r in Extensions.Restaurants)
            {
                if (board.Restaurants[r].Menu.Contains(foodCard1.Type) || board.Restaurants[r].Menu.Contains(foodCard2.Type))
                {
                    coverage++;
                }
            }

            return(coverage);
        }
Exemple #13
0
        private MoneyStatus MoneyStatus(PublicBoard board)
        {
            int day_count = board.CurrentDay / 7 * 5 + (board.CurrentDay % 7) - 1;

            if (Cash > 3 * day_count)
            {
                return(BotStrategist.MoneyStatus.Good);
            }
            else if (Cash > 3 * day_count - 5)
            {
                return(BotStrategist.MoneyStatus.Medium);
            }
            return(BotStrategist.MoneyStatus.Bad);
        }
Exemple #14
0
 protected override List <FoodType> AskFavoriteFood(PublicBoard board)
 {
     if (Character == Character.SalesRep)
     {
         return(new List <FoodType> {
             this._foodCards.First().Type, this._foodCards.Last().Type
         });
     }
     else
     {
         return(new List <FoodType> {
             this._foodCards.First().Type
         });
     }
 }
Exemple #15
0
        internal override bool HasCompletedTeamBonus(PublicBoard board)
        {
            Dictionary <PlayerBase, bool> status = new Dictionary <PlayerBase, bool>();

            foreach (PlayerBase player in board.Players)
            {
                status[player] = false;
                foreach (DayOfWeek day in Extensions.Weekdays)
                {
                    if (board.VisitedPlaces[player][day] is RestaurantPlace && board.UndesiredRestaurants[player] == (board.VisitedPlaces[player][day] as RestaurantPlace).Identifier)
                    {
                        status[player] = true;
                    }
                }
            }
            return(status.Values.All(x => x));
        }
Exemple #16
0
        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));
        }
Exemple #17
0
        internal override bool HasCompletedTeamBonus(PublicBoard board)
        {
            Dictionary <PlayerBase, int> statusBrazilian = new Dictionary <PlayerBase, int>();
            Dictionary <PlayerBase, int> statusChinese   = new Dictionary <PlayerBase, int>();

            foreach (PlayerBase player in board.Players)
            {
                statusBrazilian.Add(player, 0);
                statusChinese.Add(player, 0);
                foreach (DayOfWeek day in Extensions.Weekdays)
                {
                    statusBrazilian[player] += board.VisitedPlaces[player][day].Menu.Count(x => x == FoodType.Brazilian);
                    statusChinese[player]   += board.VisitedPlaces[player][day].Menu.Count(x => x == FoodType.Chinese);
                }
            }
            return(statusBrazilian.Values.All(x => x >= 3) && statusChinese.Values.All(x => x >= 3));
        }
Exemple #18
0
        internal override bool HasCompletedTeamBonus(PublicBoard board)
        {
            Dictionary <PlayerBase, int> statusBurger = new Dictionary <PlayerBase, int>();
            Dictionary <PlayerBase, int> statusPizza  = new Dictionary <PlayerBase, int>();

            foreach (PlayerBase player in board.Players)
            {
                statusBurger.Add(player, 0);
                statusPizza.Add(player, 0);
                foreach (DayOfWeek day in Extensions.Weekdays)
                {
                    statusBurger[player] += board.VisitedPlaces[player][day].Menu.Count(x => x == FoodType.Burger);
                    statusPizza[player]  += board.VisitedPlaces[player][day].Menu.Count(x => x == FoodType.Pizza);
                }
            }
            return(statusBurger.Values.All(x => x >= 3) && statusPizza.Values.All(x => x >= 3));
        }
 internal override bool HasCompletedForPlayer(PlayerBase player, PublicBoard board)
 {
     foreach (DayOfWeek day in Extensions.Weekdays)
     {
         if (board.Home.Visitors[day].Contains(player))
         {
             return(false);
         }
         foreach (Restaurant restaurant in Extensions.Restaurants)
         {
             if (board.Restaurants[restaurant].Visitors[day].Contains(player) && board.Restaurants[restaurant].Visitors[day].Count == 1)
             {
                 return(false);
             }
         }
     }
     return(true);
 }
        internal override bool HasCompletedForPlayer(PlayerBase player, PublicBoard board)
        {
            Dictionary <FoodType, int> foodTypes = new Dictionary <FoodType, int>();

            foreach (FoodType type in Extensions.FoodTypes)
            {
                foodTypes.Add(type, 0);
            }
            foreach (DayOfWeek day in Extensions.Weekdays)
            {
                Place place = board.VisitedPlaces[player][day];
                if (place is RestaurantPlace)
                {
                    foreach (FoodType foodType in (place as RestaurantPlace).Menu)
                    {
                        foodTypes[foodType]++;
                    }
                }
            }
            return(foodTypes.Values.Contains(Extensions.Weekdays.Count()));
        }
Exemple #21
0
        internal override bool HasCompletedTeamBonus(PublicBoard board)
        {
            Dictionary <PlayerBase, Dictionary <FoodType, int> > dictionary = new Dictionary <PlayerBase, Dictionary <FoodType, int> >();

            foreach (PlayerBase player in board.Players)
            {
                dictionary.Add(player, new Dictionary <FoodType, int>());
                foreach (FoodType food in Extensions.FoodTypes)
                {
                    dictionary[player].Add(food, 0);
                }
                foreach (DayOfWeek day in Extensions.Weekdays)
                {
                    foreach (FoodType food in board.VisitedPlaces[player][day].Menu)
                    {
                        dictionary[player][food]++;
                    }
                }
            }
            return(dictionary.All(x => x.Value.All(y => y.Value >= 2)));
        }
Exemple #22
0
 protected override List <int> ChooseDessert(PublicBoard board, IEnumerable <DessertCard> cards, int amountToTake)
 {
     return(Enumerable.Range(0, amountToTake).ToList());
 }
Exemple #23
0
 internal override bool HasCompletedTeamBonus(PublicBoard board)
 {
     return(!board.Restaurants.Any(x => x.Value.Visitors.Count() >= board.Players.Count + 2));
 }
Exemple #24
0
 internal abstract bool HasCompletedTeamBonus(PublicBoard board);
Exemple #25
0
 protected override int AskForDonationTeamObjective(PublicBoard board, Dictionary <PlayerBase, Dictionary <PlayerBase, int> > opinion, Dictionary <PlayerBase, int> intents)
 {
     return(Math.Min(7 / board.Players.Count + 1, board.PlayerCash[this]));
 }
Exemple #26
0
        internal override bool HasCompletedTeamBonus(PublicBoard board)
        {
            IEnumerable <int> cash = board.PlayerCash.Values;

            return(cash.Max() - cash.Min() <= 15);
        }
Exemple #27
0
 protected override LoyaltyCard AskLoyalty(PublicBoard board)
 {
     return(this._loyaltyCards.First());
 }
Exemple #28
0
 protected override PreferenceCard AskPreferences(PublicBoard board)
 {
     return(this._prefCards.First());
 }
Exemple #29
0
        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());
        }
Exemple #30
0
 protected override TeamBonusCard ChooseOneTeamBonus(PublicBoard board, TeamBonusCard teamBonusCard1, TeamBonusCard teamBonusCard2)
 {
     return(teamBonusCard1);
 }