private int getMax(int[] candidateMoves, Board board) {
        int myBestMove = -1;//(candidateMoves.length > 0) ? 0 : findRandomEmpty(board);

        int max = Integer.MIN_VALUE;
        for (int i = 0; i < candidateMoves.length; i++) {
            if (candidateMoves[i] >= max && board.getLocationState(new Location(i, 0)) == LocationState.EMPTY) {
                max = candidateMoves[i];
                myBestMove = i;
            }
        }
        if (myBestMove == -1) return -1;

        ArrayList<Integer> maxes = new ArrayList<>();
        for (int i = 0; i < candidateMoves.length; i++) {
            if (candidateMoves[i] == max) maxes.add(i);
        }
        if (maxes.size() > 1) {
            Random r = new Random();
            int rand = r.nextInt(maxes.size());
            myBestMove = maxes.get(rand);
        }
        if (candidateMoves[myBestMove] == 0) myBestMove = findRandomEmpty(board);
        return myBestMove;
    }//end getMax()