Backup and Restore CSCI 4526 / 6626 Solution

1 Goals
? To save and restore the state of the game
2 Modify the Game class.
The menu.
? In your Game class, activate the Save and Restore menu items.
? Save: Input an output ?le name to save in and open it. Use it to save the BoardState at the top of the undo stack. Delegate to BoardState the task of saving the current state of the board to the open ?le.
? Restore: Input an input ?le name to restore from and open it. Clear the undo and redo stacks, and provide a BoardState* on the undo stack that is ready to receive the saved game from the open ?le. Then delegate the actual input to the BoardState class. Finally, input the saved BoardState so that it becomes the only item on the undo stack. Finally, delegate to Board::undo() the task of using the newly-input BoardState to overwrite the current state of the board.
3 Modify the BoardState class.
? Implement a function serialize( ofstream& gameOut). The function will be called from Game in Game and will write the current BoardState to the open output stream.
? Implement a function realize( ifstream& gameIn). The function will be called from the main menu in Game and will read in a saved game from the open input stream.