Skip to content

Commit

Permalink
Adapts to jchess-uci-client changes
Browse files Browse the repository at this point in the history
  • Loading branch information
fathzer committed May 10, 2024
1 parent 96c36df commit 75f5356
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/com/fathzer/jchess/bot/uci/UCIEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.fathzer.jchess.bot.Engine;
import com.fathzer.jchess.bot.uci.EngineLoader.EngineData;
import com.fathzer.jchess.settings.Settings.Variant;
import com.fathzer.uci.client.GoParameters;
import com.fathzer.uci.client.GoReply.UCIMove;

public class UCIEngine extends com.fathzer.uci.client.UCIEngine implements Engine {
Expand Down Expand Up @@ -43,7 +44,12 @@ public void setPosition(String fen, List<String> moves) throws IOException {

@Override
public String getMove(CountDownState params) throws IOException {
final List<UCIMove> moves = super.go(new com.fathzer.uci.client.CountDownState(params.getRemainingMs(), params.getIncrementMs(), params.getMovesToGo())).getMoves();
final GoParameters goParams = new GoParameters();
final GoParameters.TimeControl tc = goParams.getTimeControl();
tc.setRemainingMs(params.getRemainingMs());
tc.setIncrementMs(params.getIncrementMs());
tc.setMovesToGo(params.getMovesToGo());
final List<UCIMove> moves = super.go(goParams).getMoves();
return moves.isEmpty() ? null : moves.get(0).getMove();
}

Expand Down

0 comments on commit 75f5356

Please sign in to comment.