class documentation - a shitload of it
All checks were successful
Linux arm64 / Build (push) Successful in 33s
All checks were successful
Linux arm64 / Build (push) Successful in 33s
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package chess.ai.alphabeta;
|
||||
import chess.ai.ais.AlphaBetaAI;
|
||||
|
||||
/**
|
||||
* Print the action of an alpha-beta bot on the console.
|
||||
* @see AlphaBetaAI
|
||||
*/
|
||||
public class AlphaBetaConsolePrinter {
|
||||
|
||||
private final AlphaBetaAI ai;
|
||||
private long lastTime;
|
||||
|
||||
public void connect() {
|
||||
ai.onStartEval.connect((moveCount) -> {
|
||||
this.lastTime = System.currentTimeMillis();
|
||||
System.out.println("Evaluating " + moveCount + " moves ...");
|
||||
});
|
||||
|
||||
ai.onProgress.connect((progress) -> {
|
||||
System.out.printf("Progress : %.2f %% \r", progress * 100.0f);
|
||||
});
|
||||
|
||||
ai.onCompleteEval.connect((bestMove) -> {
|
||||
System.out.println("Best move : " + bestMove + " ");
|
||||
System.out.println("Took " + (System.currentTimeMillis() - this.lastTime) + "ms");
|
||||
});
|
||||
}
|
||||
|
||||
public AlphaBetaConsolePrinter(AlphaBetaAI ai) {
|
||||
this.ai = ai;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user