private void button_GeneretaRandom_Click(object sender, EventArgs e) { FieldGenerator.GenerateRandomField(ref game.Player.board, ref game.Player.ships); button1.Enabled = true; //InitGrid(enemyGrid); //Drawer.DrawPlayerBoard(game.Player.EnemyBoard, enemyGrid); Drawer.DrawPlayerBoard(game.Player.Board, gridPlayer); }
public void StartGame() { CurrentStage = Stage.GAME; //игра начинается Random rnd = new Random(); Player.ShipPartsNumber = FieldGenerator.CountShipParts(Player.Ships); //количество живых частей корабля Computer.ShipPartsNumber = FieldGenerator.CountShipParts(Computer.Ships); CurrentTurn = Turn.COMPUTER; }
public ComputerPlayer() { InitializeBoards(); AvailablePointForShooting = new List <Point>(); Ships = new List <Ship>(); FieldGenerator.GenerateRandomField(ref board, ref ships); for (int i = 0; i < Settings.FIELD_SIZE; i++) { for (int j = 0; j < Settings.FIELD_SIZE; j++) { AvailablePointForShooting.Add(new Point(i, j)); } } rnd = new Random(); SelectNextTargetPoint(); }
private bool SetShip(int gridX, int gridY, Ship ship) { return(FieldGenerator.SetShip(game.Player.Board, game.Player.Ships, new Ship(gridX, gridY, CurrentShipLength, CurrentShipPosition))); //return game.Player.SetShip(new Ship(gridX, gridY, CurrentShipLength, CurrentShipPosition)); }