public static GridPoint[,] CreateNewBoard(int width, int height, int minesToPlace) { GridPoint[,] board = new GridPoint[width, height]; board.AddGridPointsToBoard(); board.AddMinesToBoard(minesToPlace); board.CalculateAdjacentMineCount(); foreach (var point in board) { GridPointHelper.SetDisplayCharacter(point); } return(board); }
public void AddMinesToBoard_AddsCorrectNumberOfMines() { var board = new GridPoint[3, 3]; board.AddGridPointsToBoard(); board.AddMinesToBoard(3); int placedMines = 0; foreach (var point in board) { if (point.IsMine) { placedMines++; } } Assert.Equal(3, placedMines); }