/// <summary> /// Creates the a new IMinesweeper instance. /// </summary> /// <param name="width">The width.</param> /// <param name="height">The height.</param> /// <param name="mineCount">The mine count.</param> /// <returns>Minesweeper.</returns> /// <exception cref="System.ArgumentException"></exception> public static Minesweeper Create(int width, int height, int mineCount) { var validationResult = MinesweeperBoardValidator.Create().ValidateBoard(width, height, mineCount); if (validationResult != null) { throw new ArgumentException(validationResult); } var minesweeper = new Minesweeper { tiles = TileCollection.Create(width, height), mineCount = mineCount, minesLeft = mineCount, timeElapsed = 0 }; return(minesweeper); }
/// <summary> /// Creates the a new IMinesweeper instance. /// </summary> /// <param name="width">The width.</param> /// <param name="height">The height.</param> /// <param name="mineCount">The mine count.</param> /// <returns>Minesweeper.</returns> /// <exception cref="System.ArgumentException"></exception> public static Minesweeper Create(int width, int height, int mineCount) { var validationResult = MinesweeperBoardValidator.Create().ValidateBoard(width, height, mineCount); if (validationResult != null) { throw new ArgumentException(validationResult); } var minesweeper = new Minesweeper { tiles = TileCollection.Create(width, height), mineCount = mineCount, minesLeft = mineCount, timeElapsed = 0 }; return minesweeper; }