truc fonctionnel mais avec un retouchage dans l'API. dsl

This commit is contained in:
vaisse
2026-02-06 12:12:46 +01:00
parent c278b18872
commit fe13b946b1
10 changed files with 49 additions and 7 deletions

View File

@@ -57,8 +57,8 @@ public class Simulation extends AbstractGame {
ctaken = taken;
count = 0;
}
System.out.println(" wins : "+wins+"/losses : "+losses);
System.out.println(" eval : "+(wins-losses)/EVALDEPTH);
//System.out.println(" wins : "+wins+"/losses : "+losses);
//System.out.println(" eval : "+(wins-losses)/EVALDEPTH);
return (wins-losses)/EVALDEPTH;
}
@@ -232,9 +232,7 @@ public class Simulation extends AbstractGame {
}
return bestcase;
}
}
}
private AbstractPly GiveBestMove(IBoard board) {
@@ -269,5 +267,27 @@ public class Simulation extends AbstractGame {
return simCurrentBoard.getResult();
}
public Result runForArena(){
while(!simCurrentBoard.isGameOver()){
AbstractGamePlayer player = simmapPlayers.get(simCurrentBoard.getCurrentPlayer());
IBoard board = simCurrentBoard.safeCopy();
AbstractPly ply;
if(player.jesuisMinimax()){
ply = GiveBestMove(board);
} else {
ply = player.giveYourMove(board);
}
HexPly concretePly = (HexPly) ply;
if (simCurrentBoard.isLegal(ply)) {
simCurrentBoard.doPly(ply);
taken.add(new Integer[]{concretePly.getRow(), concretePly.getCol()});
System.out.println("Player "+player+" goes ("+concretePly.getRow()+","+concretePly.getCol()+")");
}
else throw new IllegalStateException("Player "+ player + " is a bloody cheat. He tried playing : "+concretePly.getRow()+","+concretePly.getCol()+" I give up.");
}
return simCurrentBoard.getResult();
}
}