Class OnnxEvaluator
java.lang.Object
com.fortemate.dicechess.bot.OnnxEvaluator
- All Implemented Interfaces:
AutoCloseable
Evaluates board positions using an ONNX value model or falls back to engine heuristics.
-
Constructor Summary
ConstructorsConstructorDescriptionOnnxEvaluator(String modelPath) Constructs a new ONNX evaluator for the given model file path. -
Method Summary
-
Constructor Details
-
OnnxEvaluator
Constructs a new ONNX evaluator for the given model file path.- Parameters:
modelPath- filesystem path to the ONNX model file (e.g."models/baseline.onnx"). Ifnull, blank, or file does not exist, the evaluator gracefully falls back to engine heuristic evaluation.
-
-
Method Details
-
isLoaded
public boolean isLoaded()Indicates whether an ONNX model file was loaded and is active for evaluation.- Returns:
trueif ONNX model is loaded;falseif using engine heuristic fallback
-
evaluate
public float evaluate(dicechess.engine.domain.GameState state, int color) Evaluates a GameState from the perspective of the specified color.- Parameters:
state- the board state to evaluatecolor- active player's color (0 for White, 1 for Black)- Returns:
- score as a float value (higher is better for the specified color).
Falls back to
JvmApi.evaluate(GameState, int)engine heuristic evaluation if ONNX model is not loaded.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-