Move rootAlphaBeta(NodeLVL2 node, int alpha, int beta, int player, int depth) 
            throws Exception {
        Move bestMove = null;
        this.value = -10000;
        DraughtsState state = node.getState();
        List<Move> moves = state.getMoves();
        
        // When only one move is possible, immediately choose that one.
        if (moves.size() == 1){
            return moves.get(0);
        }
        
        for (Move move : moves){
            state.doMove(move);
            alpha = max(alpha, -alphaBeta(new NodeLVL2(state.clone()), 
                    -beta, -alpha, -(player), depth - 1));
            state.undoMove(move);
            if (alpha > this.value){
                this.value = alpha;
                bestMove = move;
            }
        }
        System.out.println("PlayerLVL2 count:" + count);
        count = 0;
        if (bestMove == null){
            
            // When no move is found and depth equals two, choose a random one.
            if (depth <= 2){
                Collections.shuffle(moves);
                return moves.get(0);
            }
            
            // Lower the depth when no best move is found.
            return rootAlphaBeta(node, alpha, beta, player, depth - 1);
        }
        return bestMove;
    }