fixed fenGame not updateing whiteToMove
This commit is contained in:
parent
059f672c17
commit
ca1e62397c
@ -86,7 +86,7 @@ fn fenGame(str: []const u8, alloc: std.mem.Allocator) [*c]c.game {
|
|||||||
if (pos > 64) {
|
if (pos > 64) {
|
||||||
if (chr == ' ') space += 1;
|
if (chr == ' ') space += 1;
|
||||||
if (space == 1 and chr == 'b') g.whiteToMove = false;
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
if (std.ascii.isDigit(chr)) pos += @truncate(chr - '0');
|
if (std.ascii.isDigit(chr)) pos += @truncate(chr - '0');
|
||||||
@ -154,6 +154,7 @@ test "uci position" {
|
|||||||
defer alloc.destroy(game);
|
defer alloc.destroy(game);
|
||||||
|
|
||||||
const out = uci("position startpos", game, alloc);
|
const out = uci("position startpos", game, alloc);
|
||||||
|
defer alloc.destroy(out.game);
|
||||||
try std.testing.expect(out == .game);
|
try std.testing.expect(out == .game);
|
||||||
alloc.destroy(out.game);
|
try std.testing.expect(out.game.whiteToMove == true);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user