import java.util.Stack;


public class PlayerHistory {

	private Stack undoStack;
	private Stack redoStack;
	
	public void addStep( Command c) {
		
	}
	
	public Command undo() {
		return null;
	}
	
	public Command redo() {
		return null;
	}
	
	public void clear() {
		
	}
	
	
}

@@ -18,16 +18,180 @@
 Stack;%0A%0A
+/*%0A * This class keeps track of the history of a player. Where%0A * all it has been currently, where all to go when the user %0A * hits the undo or the redo button.%0A */
 %0Apublic 
@@ -227,16 +227,25 @@
 te Stack
+%3CCommand%3E
  undoSta
@@ -247,16 +247,69 @@
 doStack;
+ // top contains what the last move of the player was
 %0A%09privat
@@ -315,16 +315,25 @@
 te Stack
+%3CCommand%3E
  redoSta
@@ -346,20 +346,282 @@
 %09public 
-void
+PlayerHistory() %7B%0A%09%09undoStack = new Stack%3CCommand%3E();%0A%09%09redoStack = new Stack%3CCommand%3E();%0A%09%7D%0A%09/*%0A%09 * This method is called when the player makes a move%0A%09 * %0A%09 * @Return %3Ccode%3Etrue%3C/code%3E if command was undoable, %0A%09 * %3Ccode%3Efalse%3C/code%3E otherwise%0A%09 */%0A%09public boolean
  addStep
@@ -621,17 +621,16 @@
 addStep(
- 
 Command 
@@ -640,129 +640,1316 @@
 %7B%0A%09%09
-%0A%09%7D%0A%09%0A%09public Command undo() %7B%0A%09%09return null;%0A%09%7D%0A%09%0A%09public Command redo() %7B%0A%09%09return null;%0A%09%7D%0A%09%0A%09public void clear() %7B%0A%09%09
+if (c.isUndoable()) %7B%0A%09%09%09undoStack.push(c);%0A%09%09%09redoStack.clear(); //you have decided to go on a new path.%0A%09%09%09return true;%0A%09%09%7D%0A%09%09return false; //the command cannot be undone. so we have to do nothing with the stack%0A%09%09%0A%09%7D%0A%09%0A%09/*%0A%09 * Calculates and returns the command that needs to be %0A%09 * executed to get back to state%0A%09 * where the player was one move ago.%0A%09 * Can return %3Ccode%3Enull %3C/code%3E. Will do it in the case where the player%0A%09 * has not even made its first move.%0A%09 * %0A%09 */%0A%09public Command undo() %7B%0A%09%09if (!undoStack.isEmpty()) %7B%0A%09%09%09Command toReturn = undoStack.pop();%0A%09%09%09toReturn = toReturn.getOpposite();%0A%09%09%09redoStack.push(toReturn);%0A%09%09%09return toReturn;%0A%09%09%09 %0A%09%09%7D%0A%09%09return null;%0A%09%7D%0A%09%0A%09/*%0A%09 * Calculates and returns the Command to be executed%0A%09 * in case the player changed his mind about changing his%0A%09 * mind.%0A%09 * Will return null in case the user has decided to go %0A%09 * on a new path, and has not hit the undo yet.%0A%09 */%0A%09public Command redo() %7B%0A%09%09%0A%09%09if (!redoStack.isEmpty()) %7B%0A%09%09%09Command toReturn = redoStack.pop();%0A%09%09%09toReturn = toReturn.getOpposite();%0A%09%09%09undoStack.push(toReturn);%0A%09%09%09return toReturn;%0A%09%09%09%0A%09%09%7D%0A%09%09return null;%0A%09%7D%0A%09%0A%09/*%0A%09 * Wipes the player history clean, in case the player dies%0A%09 * or decides to start over again.%0A%09 */%0A%09public void clear() %7B%0A%09%09undoStack.clear();%0A%09%09redoStack.clear();
 %0A%09%7D%0A

Add functionality for the methods in PlayerHistory class.