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

This is a bug??? (but not a problem) #1106

Closed
9acca9 opened this issue Sep 21, 2024 · 1 comment
Closed

This is a bug??? (but not a problem) #1106

9acca9 opened this issue Sep 21, 2024 · 1 comment

Comments

@9acca9
Copy link

9acca9 commented Sep 21, 2024

I think that maybe, maybe... i found a bug???! or maybe not.

Well. I was using your module, it is pretty amazing.

But, i noticed this:
if you make any move NOT legal move with the King the module take it as CASTLING.
It could be possible or i have a problem in my code??
Of course you first could use chess_board.legal_moves to see if it is valid or not and avoid that problem.
But it seems weird to me because instead of create an error the module take it as a valid move and believe that is Castling.

This is the part of the code that get the castling:
(...)

if chess_board.is_castling(move): 
      print("This is my move ",move)
      logging.info("I make the castling!")

i just try this with white pieces, dont know what happens with black.
For example i play e2e4, e7e5... and after that white move e1g3!!! and it seems that the module believe that that is castling
``
imagen

where it says "Me enroquè" that is "i make the castling!" in spanish.
So, i dont know.
Thanks!

Of course, this is not a problem.
Thank you very much for your beautiful module!

@niklasf
Copy link
Owner

niklasf commented Sep 22, 2024

Hi, thanks for reporting. What happens here is not a bug, but perhaps a bit surprising: Some methods have documented preconditions that are not checked for performance reasons.

For example board.is_castling():

Checks if the given pseudo-legal move is a castling move.

So the answer is only guaranteed to be valid if the move is pseudo-legal.

@niklasf niklasf closed this as completed Sep 22, 2024
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

No branches or pull requests

2 participants