corrections monte_carlo

This commit is contained in:
2026-02-05 17:59:42 +01:00
parent 4b2b37a04a
commit 0df6b74d54

View File

@@ -29,7 +29,7 @@ public class Simulation extends AbstractGame {
/*Le jeu de Hex ne peut jamais finir avec le résultat null. En utilisant cette propriété, on peut avoir cet algorithme simplifié du monte-carlo*/
private float MonteCarlo(HexBoard position){
RandomBot simplay = new RandomBot();
HexBoard simpos = position.safeCopy();
HexBoard simpos = position;
LinkedList<Integer[]> ctaken = taken;
HexPly testmove;
float wins = 0;
@@ -38,7 +38,7 @@ public class Simulation extends AbstractGame {
for(int i=0; i<EVALDEPTH; i++){
while(!simpos.isGameOver()){
testmove = (HexPly) simplay.giveYourMove(simpos);
if(!ctaken.contains(t) && simpos.isLegal(testmove)){
if(!ctaken.contains(new Integer[]{testmove.getRow(), testmove.getCol()}) && simpos.isLegal(testmove)){
ctaken.add(new Integer[]{testmove.getRow(), testmove.getCol()});
simpos.doPly(testmove);
if(simpos.getResult()==Result.LOSS){
@@ -48,7 +48,7 @@ public class Simulation extends AbstractGame {
}
}
}
simpos = position.safeCopy();
simpos = position;
ctaken = taken;
}
@@ -188,7 +188,7 @@ public class Simulation extends AbstractGame {
}
}
private float explMINAB(HexBoard position, int depth, A, B){
private float explMINAB(HexBoard position, int depth, float A, float B){
if (position.getResult()==Result.LOSS) {
return -1.0f;
} else if (position.getResult()==Result.WIN){