/// <inheritdoc/> public Game Create(int player1Index, int player2Index) { var boards = new BattleshipBoard[2]; for (var i = 0; i < 2; i++) { boards[i] = new BattleshipBoard(); filler.Fill(BattleshipBoard.Ships, boards[i]); } return(new Game(Guid.NewGuid(), new[] { player1Index, player2Index }, boards, new[] { new BoardContent(SquareContent.Unknown), new BoardContent(SquareContent.Unknown) })); }
/// <summary> /// Initializes the board by using the given filler. /// </summary> /// <param name="filler">Filler to use for filling the board</param> /// <remarks> /// The board (i.e., everything is set to water) is cleared before filling it. /// </remarks> public void Initialize(IBoardFiller filler) { Clear(SquareContent.Water); filler.Fill(Ships, this); }