adversaria ao redor. Definimos tambem uma array que mapeia o valor individual de cada casa, o que nos ajudara a ordenar os lances e aumentar a performance da engine. Repare que as casas adjacentes a uma quina nao sao consideradas desvantagem caso a quina seja nossa, os metodos badXSquares e badCSquares levam isso em consideracao. Segue a classe:import java.util.ArrayList;public class OthelloHeuristics{ private static final int[] cornerIndexes = new int[]{11, 18, 81, 88}; private static final int[] xIndexes = new int[]{22, 27, 72, 77}; private static final int[] cIndexes = new int[]{12, 21, 17, 28, 71, 82, 78, 87}; private static final int[] squareValues = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120, -20, 20, 5, 5, 20, -20, 120, 0, 0, -20, -40, -5, -5, -5, -5, -40, -20, 0, 0, 20, -5, 15, 3, 3, 15, -5, 20, 0, 0, 5, -5, 3, 3, 3, 3, -5, 5, 0, 0, 5, -5, 3, 3, 3, 3, -5, 5, 0, 0, 20, -5, 15, 3, 3, 15, -5, 20, 0, 0, -20, -40, -5, -5, -5, -5, -40, -20, 0, 0, 120, -20, 20, 5, 5, 20, -20, 120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; public static int mobility (int player, OthelloBoard board) { return board.getAllMoves(player).size(); } public static int mobilityDiff (int player, OthelloBoard board) { return mobility(player, board) - mobility(board.getOpponent(player), board); } public static int potentialMobility(int player, OthelloBoard board) { int opponent = board.getOpponent(player); int[] cells = board.getCells(); int mob = 0; for (int i = 10; i < 90; i++) { int col = i % 10; if (col != 0 && col != 9) { if (cells[i] == opponent) { for (Integer dir : OthelloBoard.DIRECTIONS) { int around = dir + i; if (cells[around] == OthelloBoard.EMPTY && cells[around] != OthelloBoard.WALL) { mob++; break; } } } } } return mob; } public static int potentialMobilityDiff(int player, OthelloBoard board) { return potentialMobility(player, board) - potentialMobility(board.getOpponent(player), board); } public static int cornerSquares (int player, OthelloBoard board) { int corners = 0; int[] cells = board.getCells(); for(int i = 0; i < cornerIndexes.length; i++) if (cells[cornerIndexes[i]] == player) corners++; return corners; } public static int cornerSquaresDiff (int player, OthelloBoard board) { return cornerSquares(player, board) - cornerSquares(board.getOpponent(player), board); } public static int badXSquares (int player, OthelloBoard board) { int x = 0; int[] cells = board.getCells(); for (int i = 0; i < 4; i++) if ((cells[cornerIndexes[i]] != player) && (cells[xIndexes[i]] == player)) x++; return x; } public static int badXSquaresDiff (int player, OthelloBoard board) { return badXSquares(player, board) - badXSquares(board.getOpponent(player), board); } public static int badCSquares (int player, OthelloBoard board) { int c = 0; int[] cells = board.getCells(); int corner = 0; for (int i = 0; i < cIndexes.length; i+= 2) { if (cells[cornerIndexes[corner++]] != player) { if (cells[cIndexes[i]] == player) c++; if (cells[cIndexes[i + 1]] == player) c++; } } return c; } public static int badCSquaresDiff (int player, OthelloBoard board) { return badCSquares(player, board) - badCSquares(board.getOpponent(player), board); } public static int discsDiff (int player, OthelloBoard