truc fonctionnel mais avec un retouchage dans l'API. dsl
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user