Example #1
0
        public void NewGame()
        {
            //For the game, [0,0] is located in the top left corner, with the largest row/column being bottom right.
            //Player move is always entered as Row then Column.

            var gridSize        = GetGridSize();
            var currentGameGrid = GridFactory.NewGameGrid(gridSize);

            var userInputMove   = new PlayerMove(0, 0);
            var maxNonMineCells = gridSize * gridSize - gridSize;
            var turnCount       = 0;


            while (!_userInputValidation.IsGameOver(currentGameGrid, userInputMove) && turnCount < maxNonMineCells)
            {
                var runAtGameStart = turnCount == 0;
                userInputMove = RunGame(userInputMove, currentGameGrid, runAtGameStart);
                turnCount++;
            }

            Console.Clear();
            Console.WriteLine(_gameMessageDisplay.EndGameMessage(currentGameGrid, userInputMove));
        }