bot alpha-beta + correctif + debut bot divin

This commit is contained in:
2026-01-29 13:34:40 -05:00
parent 27663cd583
commit aba891e060
6 changed files with 373 additions and 64 deletions

View File

@@ -280,12 +280,23 @@ public class AvalamBoard extends AbstractBoard {
*/
@Override
public IBoard safeCopy() {
Tower[][] newGrid = new Tower[SIZE][SIZE];
for (int r = 0; r < SIZE; r++)
for (int c = 0; c < SIZE; c++)
newGrid[r][c] = grid[r][c];
for (int r = 0; r < SIZE; r++) {
for (int c = 0; c < SIZE; c++) {
return new AvalamBoard(newGrid, getCurrentPlayer(), gameOver, result);
Tower t = grid[r][c];
if (t == null) {
newGrid[r][c] = null;
} else {
// Copie profonde : on recrée une nouvelle Tower indépendante
newGrid[r][c] = new Tower(t.getHeight(), t.getColor());
}
}
}
// On conserve le joueur courant
return new AvalamBoard(newGrid, getCurrentPlayer());
}
}