Skip to content

Commit 5f289a4

Browse files
committed
Fix move logging
1 parent dd5dee2 commit 5f289a4

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/main/java/bot/Bot.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -155,20 +155,21 @@ void handleGame(GameInfo game) {
155155
Board board = Board.fromFEN(fenAtGameStart);
156156
if (moves > 1) board = board.play(String.join(" ", moveList.subList(0, moves-1)));
157157
String lastMove = moveList.getLast();
158-
String lastMoveSAN = board.toSAN(lastMove);
158+
159+
String infoBeforeMove = "%s (%s) played (%s - %s)".formatted(
160+
lastMove,
161+
board.toSAN(lastMove),
162+
white + (board.whiteToMove() ? "*" : ""),
163+
black + (board.blackToMove() ? "*" : ""));
159164

160165
board = board.play(lastMove);
161166

162-
LOGGER.info("%s\n%s".formatted(
163-
"%s (%s) played (%s - %s)".formatted(
164-
lastMove,
165-
lastMoveSAN,
166-
white + (board.whiteToMove() ? "*" : ""),
167-
black + (board.blackToMove() ? "*" : "")),
168-
"%s %s %s".formatted(
169-
board.toFEN(),
170-
board.gameState(),
171-
state.status())));
167+
String infoAfterMove = "%s %s %s".formatted(
168+
board.toFEN(),
169+
board.gameState(),
170+
state.status());
171+
172+
LOGGER.info("%s\n%s".formatted(infoBeforeMove, infoAfterMove));
172173
}
173174

174175
if (state.status().ordinal() > Status.started.ordinal()) {

0 commit comments

Comments
 (0)