SebLague / Chess-Challenge

Create your own tiny chess bot!
https://www.youtube.com/watch?v=Ne40a5LkK6A
MIT License
1.78k stars 1.07k forks source link

Board.GetLegalMoves() Generates Nonsense Promotions #413

Open bferell opened 11 months ago

bferell commented 11 months ago

It appears that when a black pawn reaches the 3rd rank, Board.GetLegalMoves() is confused and thinks the pawn is in the 7th rank. It returns legal moves such as 'a2a1q', despite the pawn being on 'a3' rather than on 'a2'.

not_a_promotion allMoves.csv

Generated this situation on version 1.18 (actually on current head as of this issue), and repeatably finding it when MyBot is set to a copy of EvilBot with additional logic analyzing promotion moves. Interestingly, selecting that move in the shown position does not appear to be recognized as Illegal Move.

bferell commented 11 months ago

Further analysis appears to indicate that this only happens when it is black to move.