}
return presentState;
}
public GameState getMove(GameState state, int x, int y) {
GameState retVal = null;
XYLocation loc = new XYLocation(x, y);
List<XYLocation> moves = getMoves(state);
List<XYLocation> newMoves = new ArrayList<XYLocation>(moves);
if (moves.contains(loc)) {
int index = newMoves.indexOf(loc);
newMoves.remove(index);
retVal = new GameState();
retVal.put("moves", newMoves);
TicTacToeBoard newBoard = getBoard(state).cloneBoard();
if (getPlayerToMove(state) == "X") {
newBoard.markX(x, y);
retVal.put("player", "O");
} else {
newBoard.markO(x, y);
retVal.put("player", "X");
}
retVal.put("board", newBoard);
retVal.put(
"utility",
new Integer(computeUtility(newBoard,
getPlayerToMove(getState()))));
retVal.put("level", new Integer(getLevel(state) + 1));
// presentState = retVal;
}
return retVal;
}