private static void InitBot() { Bot = BotFactory.Construct("Wunderwaffe"); Players = new Dictionary <PlayerIDType, GamePlayer>(); Players.Add(MyPlayerID, new GamePlayer(MyPlayerID, GamePlayerState.Playing, PlayerInvite.NoTeam, 0, false, false, false)); Players.Add(OpponentPlayerID, new GamePlayer(OpponentPlayerID, GamePlayerState.Playing, PlayerInvite.NoTeam, 0, false, false, false)); var incomes = new Dictionary <PlayerIDType, PlayerIncome>(); incomes.Add(MyPlayerID, new PlayerIncome(StartingArmies)); incomes.Add(OpponentPlayerID, new PlayerIncome(5)); Bot.Init(MyPlayerID, Players, Map, DistributionStanding, new GameSettings(0.6, 0.7, true, 5, 2, 2, 0, (DistributionIDType)0, new Dictionary <BonusIDType, int>(), false, false, false), NumberOfTurns, incomes, PrevTurn, LatestTurnStanding, PreviousTurnStanding, new Dictionary <PlayerIDType, TeammateOrders>(), new List <CardInstance>(), 0); }
public static bool PlayGame(string botName, GameObject game, PlayerIDType playerID, GameSettings settings, MapDetails map, Action <List <TerritoryIDType> > sendPicks, Action <List <GameOrder> > sendOrders) { if (game.State == GameState.WaitingForPlayers) { return(true); } if (!game.Players.ContainsKey(playerID)) { return(false); //not in game } if (game.Players[playerID].State == GamePlayerState.Invited) { throw new NotImplementedException("TODO: Accept the invite"); } if (game.Players[playerID].State != GamePlayerState.Playing) { return(false); //not alive anymore } var bot = BotFactory.Construct(botName); bot.Init(playerID, game.Players, map, game.LatestInfo.DistributionStanding, settings, game.NumberOfTurns, game.LatestInfo.Income, game.LatestInfo.LatestTurn == null ? null : game.LatestInfo.LatestTurn.Orders, game.LatestInfo.LatestStanding, game.LatestInfo.PreviousTurnStanding, game.LatestInfo.TeammatesOrders, game.LatestInfo.Cards, game.LatestInfo.CardsMustUse); AILog.Log("PlayGame. State=" + game.State + ", numTurns=" + game.NumberOfTurns + ", income=" + game.LatestInfo.Income[playerID] + ", cardsMustUse=" + game.LatestInfo.CardsMustUse); if (game.State == GameState.DistributingTerritories) { sendPicks(bot.GetPicks()); } else if (game.State == GameState.Playing) { sendOrders(bot.GetOrders()); } return(true); }