fixed fenGame not updateing whiteToMove

This commit is contained in:
k 2025-09-26 13:30:32 -04:00
parent 059f672c17
commit ca1e62397c

View File

@ -86,7 +86,7 @@ fn fenGame(str: []const u8, alloc: std.mem.Allocator) [*c]c.game {
if (pos > 64) {
if (chr == ' ') space += 1;
if (space == 1 and chr == 'b') g.whiteToMove = false;
if (space == 1 and chr == 'w') g.whiteToMove = false;
if (space == 1 and chr == 'w') g.whiteToMove = true;
continue;
}
if (std.ascii.isDigit(chr)) pos += @truncate(chr - '0');
@ -154,6 +154,7 @@ test "uci position" {
defer alloc.destroy(game);
const out = uci("position startpos", game, alloc);
defer alloc.destroy(out.game);
try std.testing.expect(out == .game);
alloc.destroy(out.game);
try std.testing.expect(out.game.whiteToMove == true);
}