public void SelectCell(int x, int y) { stateBoard.revealCell(x, y, indexBoard.getIndexBoard()); undoStack.Push(stateBoard.Clone()); redoStack.Clear(); stateBoard.displayStateBoard(); }
// Start the game, allow the player to input x and y to reveal cells public void Start() { this.indexBoard.createIndexBoard(); this.stateBoard.createStateBoard(); undoStack.Push(new StateBoard(height, width, stateBoard.getStateBoard())); Console.Clear(); bool won = true; while (won) { Console.WriteLine("Input the position to reveal (x,y): "); int x = Convert.ToInt32(Console.ReadLine()); int y = Convert.ToInt32(Console.ReadLine()); if (x == -1 && y == -1) { UndoFunc(); } if (x == -2 && y == -2) { RedoFunc(); } if (x > -1 && y > -1) { stateBoard.revealCell(x, y, indexBoard.getIndexBoard()); undoStack.Push(stateBoard.Clone()); stateBoard.displayStateBoard(); } displayBoard(); won = this.stateBoard.winCondition(mineNum); } }