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