/** * Returns the score of the given move made by the given color based upon searches to the * specified depth. * * @param m the move to score * @param depth the max depth to search to * @param color the player who makes the move * @return the score of the move */ private int getScore(Move m, int depth, int color, int a, int b) { board.makeMove(m, color); depth--; int score = 0; if (board.hasNetwork(oppositeColor(this.color))) { score = Scorer.MINSCORE - depth; } else if (board.hasNetwork(this.color)) { score = Scorer.MAXSCORE + depth; } else if (depth == 0 || Scorer.hasScore(board, color)) { score = Scorer.getScore(board, this.color); } else { score = chooseMove(depth, oppositeColor(color), a, b).score; Scorer.addScore(board, color, score); } board.rollback(); return score; }