public Game(Config config) { double startMoney = config.StartMoney; Player1 = new Player(new AILoader(config.Player1AIPath), startMoney); Player2 = new Player(new AILoader(config.Player2AIPath), startMoney); initAI(Player1); initAI(Player2); Conf = config; }
private void setColor(Bitmap bitmap, Coordinates coords, Color player1Color, Color player2Color, Player player1) { if (player1 == null || player1 == game.Player1) { bitmap.SetPixel(coords.X, coords.Y, player1Color); } else { bitmap.SetPixel(coords.X, coords.Y, player2Color); } }
private bool checkPlayerPointsByPlayer(Player player, Player otherPlayer) { if (player.Points > otherPlayer.Points) { stop(); MessageBox.Show(String.Format(Messages.PLAYER_WON_TIME_OUT, player.AI.Playername, player.Points), Messages.PLAYER_WON_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information); return true; } return false; }
private bool checkMoneyAndAntsByPlayer(Player player, Player otherPlayer) { if (player.Money < Helper.CostCalculator.LOWEST_COST_VALUE && player.AntCount == 0) { stop(); MessageBox.Show(String.Format(Messages.PLAYER_WON_OUT_OF_MONEY_AND_ANTS, player.AI.Playername, otherPlayer.AI.Playername), Messages.PLAYER_WON_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information); return true; } return false; }
private bool checkMaxPointsByPlayer(Player player) { if (player.Points >= game.Conf.Points) { stop(); MessageBox.Show(String.Format(Messages.PLAYER_WON_MAX_POINTS, player.AI.Playername), Messages.PLAYER_WON_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information); return true; } return false; }
private void initAI(Player player) { player.AI = player.AILoader.createAIInstance(this, player); }