Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix small test conversion #504

Merged
merged 2 commits into from
Dec 14, 2023

Conversation

lenguyenthanh
Copy link
Member

This happen when in White's turn, and there is a enpassant on b6.
Before this fix, it is mistaken the b from b6 as Black's turn. So,
the fix is make sure that only set black turn if there is no number
after character b.

@lenguyenthanh lenguyenthanh force-pushed the fix-small-test-conversion branch from c3a2cec to a18162a Compare December 14, 2023 19:58
This happen when in White's turn, and there is a enpassant on b6.
Before this fix, it is mistaken the b from b6 as Black's turn. So,
the fix is make sure that only set black turn if there is no number
after character b.
@lenguyenthanh lenguyenthanh force-pushed the fix-small-test-conversion branch from a18162a to 32defa1 Compare December 14, 2023 20:04
@@ -92,7 +92,7 @@ object SmallFen extends OpaqueString[SmallFen]:
val (board, error) = Fen.makeBoardWithCrazyPromoted(e, chess.variant.Standard)
val boardStr = Fen.writeBoard(board)
val boardSize = boardStr.value.count(_ != '/')
val isBlackTurn = e.lift(boardSize).exists(_ == 'b')
val isBlackTurn = e.lift(boardSize).exists(_ == 'b') && !e.lift(boardSize + 1).exists(_.isDigit)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha, so tricky

@ornicar ornicar merged commit eecd0cf into lichess-org:master Dec 14, 2023
1 check passed
@lenguyenthanh lenguyenthanh deleted the fix-small-test-conversion branch December 14, 2023 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants