public Game(IPlayer player) { this.player = player; State = GameState.IN_PROCESS; var generator = new BoardGenerator(); Board = generator.Generate(4, 4); }
public Game() { player = null; State = GameState.IN_PROCESS; var generator = new BoardGenerator(); Board = generator.Generate(4, 4); }
public void BeginGame() { currentMaze = Instantiate(mazePrefab); currentMaze.Generate(); SpawnCharacter(0); SpawnCharacter(1); myPlayer = 0; FakeNetworkController.instance.SendTurnChange(0); }
static void TestMinesweeper() { BoardGenerator boardGenerator = new BoardGenerator(1234); Board board = boardGenerator.Generate(10, 10, 10); ShowBoardDisplay(board); ShowCell(board, 0, 0); ShowBoardDisplay(board); ShowCell(board, 9, 0); ShowBoardDisplay(board); throw new Exception("END"); }
public void Generate_ShipsDontOverlap() { var boardGenerator = new BoardGenerator(_validColumns, _validRows); var board = boardGenerator.Generate(); var coordinates = board.Ships .SelectMany(ship => ship.Position) .ToList(); var uniqueCoordinates = new HashSet <Coordinates>(coordinates); uniqueCoordinates.Count.Should().Be(coordinates.Count); }
public void BoardGeneratorTest() { const int size = 5; char[,] expected = new char[size, size] { { ' ', ' ', ' ', ' ', ' ' }, { ' ', ' ', ' ', ' ', ' ' }, { ' ', ' ', ' ', ' ', ' ' }, { ' ', ' ', ' ', ' ', ' ' }, { ' ', ' ', ' ', ' ', ' ' } }; CollectionAssert.AreEqual(expected, BoardGenerator.Generate(size, ' ')); }
public void Generate_CreatesBoardWithCorrectShips() { var boardGenerator = new BoardGenerator(_validColumns, _validRows); var board = boardGenerator.Generate(); board.Ships.Count.Should().Be(3); board.Ships .Count(ship => ship.Name == "Battleship" && ship.Position.Count == 5) .Should() .Be(1); board.Ships .Count(ship => ship.Name == "Destroyer" && ship.Position.Count == 4) .Should() .Be(2); }
// Start is called before the first frame update void Start() { boardGenerator.Generate(size); camera.AdjustPosition(size); }