//撤销悔棋,恢复到下一个备忘录 static void Redo(Chessman chessman) { Console.WriteLine("******撤销悔棋******"); index++; chessman.Restore(mementoCaretaker.GetMemento(index)); chessman.Show(); }
//下棋,同时保存备忘录 static void Play(Chessman chessman) { mementoCaretaker.AddMemento(chessman.Save()); index++; chessman.Show(); }