/* * Creates a tree of moves to take with their evaluated scores */ public void createSearchSpace(int level, State state, Board board, boolean myTurn) { int[] openColumns = board.getOpenColumns(); state.nextMoves = new State[openColumns.length]; for (int i = 0; i < openColumns.length; i++) { int move = openColumns[i]; board.handleMove(myTurn, move); int score = heuristic.getScore(board); state.nextMoves[i] = new State(move, board, score); if (level != depth && board.hasWinner() == false) createSearchSpace(level + 1, state.nextMoves[i], board, !myTurn); board.undoMove(move); board.setHasWinner(false); } }