//Undo function and Try not to make stack be empty public void UndoFunc() { try { redoStack.Push(undoStack.Pop().Clone()); this.stateBoard = undoStack.Peek().Clone(); } catch (Exception) { } }
/// <summary> /// Constructor /// With given params, it initialise (creates new blank) indexBoard and stateBoard /// </summary> /// <param name="height"></param> /// <param name="width"></param> /// <param name="mineNum"></param> public Board(int height, int width, int mineNum) { indexBoard = new IndexBoard(height, width, mineNum); stateBoard = new StateBoard(height, width); //Record this.height = height; this.width = width; this.mineNum = mineNum; }