Example #1
0
        /// <summary>
        /// Implement your bot here.
        /// </summary>
        /// <param name="map">The gamemap.</param>
        /// <param name="visiblePlayers">Players that are visible to your bot.</param>
        /// <returns>The action you wish to execute.</returns>
        internal string ExecuteTurn(Map map, IEnumerable <IPlayer> visiblePlayers)
        {
            Console.WriteLine("My pos = " + PlayerInfo.Position.ToString());
            Console.WriteLine("House  = " + PlayerInfo.HouseLocation.ToString());
            Console.WriteLine("Total  = " + PlayerInfo.TotalResources.ToString());
            Console.WriteLine("Collect= " + PlayerInfo.CollectingSpeed.ToString());
            Console.WriteLine("Carryin= " + PlayerInfo.CarryingCapacity.ToString());
            Console.WriteLine("Atk    = " + PlayerInfo.AttackPower.ToString());
            Console.WriteLine("Def    = " + PlayerInfo.Defence.ToString());
            Console.WriteLine("Health = " + PlayerInfo.Health.ToString());
            Console.WriteLine("Max Hea= " + PlayerInfo.MaxHealth.ToString());
            Console.WriteLine("C1     = " + (PlayerInfo.Position == PlayerInfo.HouseLocation &&
                                             PlayerInfo.TotalResources >= 10000 &&
                                             PlayerInfo.CollectingSpeed == 1).ToString());
            Console.WriteLine("C2     = " + (PlayerInfo.Position == PlayerInfo.HouseLocation &&
                                             PlayerInfo.TotalResources >= 10000 &&
                                             PlayerInfo.CarryingCapacity == 1000).ToString());


            //Bypass upgrade
            if (PlayerInfo.Position == PlayerInfo.HouseLocation &&
                PlayerInfo.TotalResources >= 10000 &&
                PlayerInfo.CarryingCapacity == 1000)
            {
                Console.WriteLine("Buying a Carrying Capacity");
                return(AIHelper.CreateUpgradeAction(UpgradeType.CarryingCapacity));
            }
            if (PlayerInfo.Position == PlayerInfo.HouseLocation &&
                PlayerInfo.TotalResources >= 10000 &&
                PlayerInfo.CarryingCapacity == 1250)
            {
                Console.WriteLine("Buying a Carrying Capacity");
                return(AIHelper.CreateUpgradeAction(UpgradeType.CarryingCapacity));
            }
            if (PlayerInfo.Position == PlayerInfo.HouseLocation &&
                PlayerInfo.TotalResources >= 10000 &&
                PlayerInfo.AttackPower == 1)
            {
                Console.WriteLine("Buying a Attack");
                return(AIHelper.CreateUpgradeAction(UpgradeType.AttackPower));
            }
            if (PlayerInfo.Position == PlayerInfo.HouseLocation &&
                PlayerInfo.TotalResources >= 10000 &&
                PlayerInfo.Defence == 1)
            {
                Console.WriteLine("Buying a Defence");
                return(AIHelper.CreateUpgradeAction(UpgradeType.Defence));
            }
            if (PlayerInfo.Position == PlayerInfo.HouseLocation &&
                PlayerInfo.TotalResources >= 15000 &&
                PlayerInfo.AttackPower == 2)
            {
                Console.WriteLine("Buying a Attack");
                return(AIHelper.CreateUpgradeAction(UpgradeType.AttackPower));
            }
            if (PlayerInfo.Position == PlayerInfo.HouseLocation &&
                PlayerInfo.TotalResources >= 15000 &&
                PlayerInfo.Defence == 2)
            {
                Console.WriteLine("Buying a Defence");
                return(AIHelper.CreateUpgradeAction(UpgradeType.Defence));
            }
            if (PlayerInfo.Position == PlayerInfo.HouseLocation &&
                PlayerInfo.TotalResources >= 25000 &&
                PlayerInfo.AttackPower == 4)
            {
                Console.WriteLine("Buying a Attack");
                return(AIHelper.CreateUpgradeAction(UpgradeType.AttackPower));
            }

            //fin des upgrades


            //update map of the world
            worldMap.UpdateMap(map.GetVisibleTiles());
            //worldMap.UpdateOtherPLayerMap(gameInfo.OtherPlayers);
            StrategyManager.PickStrategy(PlayerInfo, visiblePlayers, worldMap);
            return(StrategyManager.currentStrategy.GetNextMove(PlayerInfo, visiblePlayers, worldMap));

            /*string action = null;
             *
             * Console.WriteLine("Collect= " + PlayerInfo.CollectingSpeed.ToString());
             * Console.WriteLine("Carryin= " + PlayerInfo.CarryingCapacity.ToString());
             * =======
             *
             *
             * //Bypass upgrade
             * if (PlayerInfo.Position == PlayerInfo.HouseLocation && !alreadyTriedToBuy)
             * {
             *  Console.WriteLine("Buying a Carrying Capacity");
             *  alreadyTriedToBuy = true;
             *  return AIHelper.CreateUpgradeAction(UpgradeType.CarryingCapacity);
             * }
             * if (PlayerInfo.Position != PlayerInfo.HouseLocation)
             * {
             *  alreadyTriedToBuy = false;
             * }
             *
             *
             *
             * //update map of the world
             * worldMap.UpdateMap(map.GetVisibleTiles());
             * //worldMap.UpdateOtherPLayerMap(gameInfo.OtherPlayers);
             * StrategyManager.PickStrategy();
             * return StrategyManager.currentStrategy.GetNextMove(PlayerInfo, visiblePlayers, worldMap);
             *
             * /*string action = null;
             *
             * string action = null;
             * while (action == null)
             * {
             *  if (currentAction == null)
             *  {
             *      currentAction = strategy.NextAction(worldMap, PlayerInfo);
             *      if (currentAction == null)
             *      {
             *          break;
             *      }
             *      //log(currentAction.ToString());
             *  }
             *  action = currentAction.NextAction(worldMap, PlayerInfo);
             *  if (action == null)
             *  {
             *      currentAction = null;
             *  }
             * }
             *
             * return action;*/
        }