Beispiel #1
0
        public void ProcessAction(Action action)
        {
            switch (action)
            {
            case FinishGameAction _:
                _gameFinished = true;
                break;

            case SelectCellAction selectCellAction:
                _boardManager.SelectCell(_board, selectCellAction.CellPosition);

                // All the cells that are not mines has been selected. We WON.
                if (UserWon())
                {
                    _gameFinished = true;
                    _boardPrinter.PrintBoardWithCoords(_board);
                    MineSweeperConsole.WriteLine("YOU WON");
                }

                break;

            case FlagCellAction flagCellAction:
                _boardManager.FlagCell(_board, flagCellAction.CellPosition);
                break;
            }
        }