I think I ran across an issue with validating FEN when there are three rooks on the board:
iex(1)> :binbo_game.new("r3k2r/2p1qppp/p3p3/n2n4/P2P4/P2QPNP1/1p1N1PBP/2r1RRK1 b kq - 0 1")
{:error, {:castling, {:black, :both_sides}}}
That position results from the pawn at c2 advancing to c1 and under-promoting to rook.
I'm not confident enough in my Erlang to submit a pull request, but I think it may just be a matter of changing line 1011 of src/binbo_position.erl from:
case IsKingOnPlace andalso (RooksBB =:= (SqABB bor SqHBB)) of
to something like:
case IsKingOnPlace andalso (RooksBB band (SqABB bor SqHBB)) =:= (SqABB bor SqHBB) of
So, instead of testing, in the case of black, "does black have exactly two rooks and are they on a1 and h8", instead test "does black have a rook on a1 and h8".
Greetings, and excellent library!
I think I ran across an issue with validating FEN when there are three rooks on the board:
That position results from the pawn at c2 advancing to c1 and under-promoting to rook.
I'm not confident enough in my Erlang to submit a pull request, but I think it may just be a matter of changing line 1011 of src/binbo_position.erl from:
to something like:
So, instead of testing, in the case of black, "does black have exactly two rooks and are they on a1 and h8", instead test "does black have a rook on a1 and h8".