parent
f7d1758b28
commit
4f19244d40
@ -103,13 +103,84 @@ public class UCIHandle {
|
|||||||
public void positionMoves(List<Move> moves) {
|
public void positionMoves(List<Move> moves) {
|
||||||
StringJoiner joiner = new StringJoiner(" ");
|
StringJoiner joiner = new StringJoiner(" ");
|
||||||
moves.forEach(m -> joiner.add(m.toLAN()));
|
moves.forEach(m -> joiner.add(m.toLAN()));
|
||||||
out.println("position moves " + joiner.toString());
|
out.println("position moves " + joiner);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: go with parameters
|
/**
|
||||||
|
* Starts calculating on the current position.
|
||||||
|
*/
|
||||||
public void go() { out.println("go"); }
|
public void go() { out.println("go"); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts calculating on the current position.
|
||||||
|
* This command has multiple optional parameters which will only be included in
|
||||||
|
* the call if they are not {@code null}, greater than zero or {@code true} for
|
||||||
|
* {@code searchMoves}, all integer parameters and all boolean parameters
|
||||||
|
* respectively.
|
||||||
|
*
|
||||||
|
* @param searchMoves restrict the search to these moves only
|
||||||
|
* @param ponder start the search in ponder mode
|
||||||
|
* @param wTime the amount of milliseconds left on white's clock
|
||||||
|
* @param bTime the amount of milliseconds left on black's clocks
|
||||||
|
* @param wInc white's increment per move in milliseconds
|
||||||
|
* @param bInc black's increment per move in milliseconds
|
||||||
|
* @param movesToGo the number of moves left until the next time control
|
||||||
|
* @param depth the maximal amount of plies to search
|
||||||
|
* @param nodes the maximal amount of nodes to search
|
||||||
|
* @param mate the amount of moves in which to search for a mate
|
||||||
|
* @param moveTime the exact search time
|
||||||
|
* @param infinite search until the {@code stop} command
|
||||||
|
*/
|
||||||
|
public void go(List<Move> searchMoves, boolean ponder, int wTime, int bTime, int wInc, int bInc, int movesToGo, int depth, int nodes, int mate,
|
||||||
|
int moveTime, boolean infinite) {
|
||||||
|
StringJoiner joiner = new StringJoiner(" ");
|
||||||
|
joiner.add("go");
|
||||||
|
|
||||||
|
if (searchMoves != null && !searchMoves.isEmpty()) {
|
||||||
|
joiner.add("searchmoves");
|
||||||
|
searchMoves.forEach(m -> joiner.add(m.toLAN()));
|
||||||
|
}
|
||||||
|
if (ponder) joiner.add("ponder");
|
||||||
|
if (wTime > 0) {
|
||||||
|
joiner.add("wtime");
|
||||||
|
joiner.add(String.valueOf(wTime));
|
||||||
|
}
|
||||||
|
if (bTime > 0) {
|
||||||
|
joiner.add("btime");
|
||||||
|
joiner.add(String.valueOf(bTime));
|
||||||
|
}
|
||||||
|
if (wInc > 0) {
|
||||||
|
joiner.add("winc");
|
||||||
|
joiner.add(String.valueOf(wInc));
|
||||||
|
}
|
||||||
|
if (bInc > 0) {
|
||||||
|
joiner.add("bind");
|
||||||
|
joiner.add(String.valueOf(bInc));
|
||||||
|
}
|
||||||
|
if (movesToGo > 0) {
|
||||||
|
joiner.add("movestogo");
|
||||||
|
joiner.add(String.valueOf(movesToGo));
|
||||||
|
}
|
||||||
|
if (depth > 0) {
|
||||||
|
joiner.add("depth");
|
||||||
|
joiner.add(String.valueOf(depth));
|
||||||
|
}
|
||||||
|
if (nodes > 0) {
|
||||||
|
joiner.add("nodes");
|
||||||
|
joiner.add(String.valueOf(nodes));
|
||||||
|
}
|
||||||
|
if (mate > 0) {
|
||||||
|
joiner.add("mate");
|
||||||
|
joiner.add(String.valueOf(mate));
|
||||||
|
}
|
||||||
|
if (moveTime > 0) {
|
||||||
|
joiner.add("movetime");
|
||||||
|
joiner.add(String.valueOf(moveTime));
|
||||||
|
}
|
||||||
|
if (infinite) joiner.add("infinite");
|
||||||
|
out.println(joiner);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stops calculation as soon as possible.
|
* Stops calculation as soon as possible.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user