}
fn parseMove(self: *const @This(), in: Str) !?BitMove {
var move: BitMove = .{ .source = undefined, .target = undefined, .piece = undefined };
move.source = @intToEnum(Square, (in[0] - 'a' + (8 - (in[1] - '0')) * SIZE));
move.target = @intToEnum(Square, (in[2] - 'a' + (8 - (in[3] - '0')) * SIZE));
var ml = try MoveList.init(0);
try self.generateMoves(&ml);
for (ml.slice()) |ml_move| {
if (move.source == ml_move.source and move.target == ml_move.target) {
move = ml_move;
// if there is a promotion, check if it is the right one
if (move.prom != .none) {
switch (move.prom) {
.N => if (in[4] != 'N') continue,
.n => if (in[4] != 'n') continue,
.B => if (in[4] != 'B') continue,
.b => if (in[4] != 'b') continue,
.R => if (in[4] != 'R') continue,
.r => if (in[4] != 'r') continue,
.Q => if (in[4] != 'Q') continue,
.q => if (in[4] != 'q') continue,
else => unreachable,
}
}
return move;
}
}
return null;