Super IA #5

Merged
Persson-dev merged 15 commits from deepmind into main 2025-04-30 18:28:02 +00:00
Showing only changes of commit 8354df5add - Show all commits

View File

@@ -38,13 +38,9 @@ public class AlphaBetaThread extends Thread {
private float getEndGameEvaluation() {
Color currentTurn = this.simulation.getPlayerTurn();
if (currentTurn == this.color) {
return HORRIBLE_MOVE;
} else {
if (this.simulation.getBoard().isKingInCheck(currentTurn))
return GREAT_MOVE;
return getBoardEvaluation() + PieceCost.PAWN;
}
if (this.simulation.getBoard().isKingInCheck(currentTurn))
return GREAT_MOVE;
return getBoardEvaluation() - PieceCost.PAWN;
}
private float getBoardEvaluation() {
@@ -57,8 +53,6 @@ public class AlphaBetaThread extends Thread {
result += pieceCost.getCost(piece) + piecePosCost.getEvaluation(piece, coordinate);
}
}
if (this.simulation.getPlayerTurn() != color)
return -result;
return result;
}
@@ -70,9 +64,6 @@ public class AlphaBetaThread extends Thread {
}
private float negaMax(int depth, float alpha, float beta) {
if (depth == 0)
return getBoardEvaluation();
float value = MIN_FLOAT;
List<Move> moves = this.simulation.getAllowedMoves();
@@ -84,7 +75,7 @@ public class AlphaBetaThread extends Thread {
for (Move move : moves) {
this.simulation.tryMove(move);
movesCost.add(Map.entry(move, getBoardEvaluation()));
movesCost.add(Map.entry(move, -getBoardEvaluation()));
this.simulation.undoMove();
}