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

Should not accept fen with two white kings #283

Closed
loloof64 opened this issue May 30, 2021 · 2 comments · May be fixed by #306
Closed

Should not accept fen with two white kings #283

loloof64 opened this issue May 30, 2021 · 2 comments · May be fixed by #306

Comments

@loloof64
Copy link

loloof64 commented May 30, 2021

The following fen has two white kings and no black king

8/2K5/8/8/2K1NB2/8/8/8 w - - 96 46

So I expect the framework to detect it as an illegal position and set the board fen to empty (8/8/8/8/8/8/8/8 w - - 0 1), like for other illegal positions. But it is not the case.

The position has been accepted and board set to this illegal position !

Indeed, when I check the validate_fen function, it seems that there is no check for the pieces count.

@cameronspeakflash
Copy link

Also should not accept pawns on ranks 1 and 8, or kings of opposite color touching:
8/8/8/8/8/1p6/8/6kK w - - 0 1

@jhlywa
Copy link
Owner

jhlywa commented Jan 16, 2023

Thanks for the report. This issue has been fixed in the latest release (1.0.0-beta.1). The constructor and the .load() method now throw an exception with the message Invalid FEN: too many white kings

@jhlywa jhlywa closed this as completed Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants