Skip to content

Commit

Permalink
MyTinyEvaluator => example of static reuse of SimplifiedEvaluator
Browse files Browse the repository at this point in the history
  • Loading branch information
fathzer committed Mar 7, 2024
1 parent 9c8f092 commit 2a04678
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,25 @@
import com.fathzer.games.ai.evaluation.StaticEvaluator;
import com.fathzer.games.ai.evaluation.ZeroSumEvaluator;
import com.fathzer.jchess.chesslib.ChessLibMoveGenerator;
import com.github.bhlangonijr.chesslib.Board;
import com.github.bhlangonijr.chesslib.move.Move;

public class MyTinyEvaluator implements StaticEvaluator<Move, ChessLibMoveGenerator>, ZeroSumEvaluator<Move, ChessLibMoveGenerator> {
private final SimplifiedEvaluator ev = new SimplifiedEvaluator();

@Override
public int evaluateAsWhite(ChessLibMoveGenerator board) {
// TODO Auto-generated method stub
return 0;
// Calculer l'évaluation de base
ev.init(board);
int baseEvaluation = ev.evaluate(board);
// Tu peux ajouter ce qui concerne les chaines de pions, mauvais/bon fous, etc à l'évaluation de base ...
return baseEvaluation;
}

public static void main(String[] args) {
// Exemple pour créer un ChessLibMoveGenerator à partir d'un FEN et l'évaluer
ChessLibMoveGenerator mvg = new ChessLibMoveGenerator(new Board());
mvg.getBoard().loadFromFen("8/3b3p/p3P1p1/3K4/5P1P/2k5/8/8 b - - 0 56");
System.out.println(new MyTinyEvaluator().evaluate(mvg));
}
}

0 comments on commit 2a04678

Please sign in to comment.