/************************************************* * Analyze Attacks ************************************************/ int[][] pawns = color ? pawnsW : pawnsB; for (int i=0;i= 0 && position[0] <= 7 && position[1] >= 0 && position[1] <= 7){ if (Bitsmagic.isPawnAt(position, boardEnemy)){ score = score + VALUE_ATTACK; /************************************************* * Analyze Defences V2.0 ************************************************/ int[] position2 = {pawns[i][0], pawns[i][1] - offsetY}; // Analyze Y-1 // Verifying defence at -1 on x-axis position2[0] = position2[0] - 1; if (position2[0] >= 0 && position2[0] <= 7 && position2[1] >= 0 && position2[1] <= 7){ if (Bitsmagic.isPawnAt(position2, board)){ score = score + VALUE_DEFENCE; } } // Verifying defence at +1 on x-axis position2[0] = position2[0] + 2; if (position2[0] >= 0 && position2[0] <= 7 && position2[1] >= 0 && position2[1] <= 7){ if (Bitsmagic.isPawnAt(position2, board)){ score = score + VALUE_DEFENCE; } } } } // Verifying attack at +1 on x-axis position[0] = position[0] + 2; if (position[0] >= 0 && position[0] <= 7 && position[1] >= 0 && position[1] <= 7){ if (Bitsmagic.isPawnAt(position, boardEnemy)){ score = score + VALUE_ATTACK; /************************************************* * Analyze Defences V2.0 ************************************************/ int[] position3 = {pawns[i][0], pawns[i][1] - offsetY}; // Analyze Y-1 // Verifying defence at -1 on x-axis position3[0] = position3[0] - 1; if (position3[0] >= 0 && position3[0] <= 7 && position3[1] >= 0 && position3[1] <= 7){ if (Bitsmagic.isPawnAt(position3, board)){ score = score + VALUE_DEFENCE; } } // Verifying defence at +1 on x-axis position3[0] = position3[0] + 2; if (position3[0] >= 0 && position3[0] <= 7 && position3[1] >= 0 && position3[1] <= 7){ if (Bitsmagic.isPawnAt(position3, board)){ score = score + VALUE_DEFENCE; } } } } }