Class FileSaver

java.lang.Object
  extended by FileSaver

public class FileSaver
extends java.lang.Object

FileSaver writes the state of a game to a file.

Author:
willb

Constructor Summary
FileSaver()
           
 
Method Summary
 boolean saveGameFile(java.lang.String filename)
          Saves the state of the game to a file, reading from the Grid objects for the CPU and human players and the Game object as needed.
 void setCPUPlayerBoard(Grid g)
          Sets the Grid for the CPU player.
 void setGame(Game g)
          Sets the Game to reconstitute moves into.
 void setHumanPlayerBoard(Grid g)
          Sets the Grid for the human player.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSaver

public FileSaver()
Method Detail

setHumanPlayerBoard

public void setHumanPlayerBoard(Grid g)
Sets the Grid for the human player.

Parameters:
g -

setCPUPlayerBoard

public void setCPUPlayerBoard(Grid g)
Sets the Grid for the CPU player.

Parameters:
g -

setGame

public void setGame(Game g)
Sets the Game to reconstitute moves into.

Parameters:
g -

saveGameFile

public boolean saveGameFile(java.lang.String filename)
Saves the state of the game to a file, reading from the Grid objects for the CPU and human players and the Game object as needed. If file saving is unsuccessful, it will print a user-readable message indicating why.

Parameters:
filename -
Returns:
true if it completes successfully; false otherwise.