jhlywa / chess.js

A TypeScript chess library for chess move generation/validation, piece placement/movement, and check/checkmate/draw detection
BSD 2-Clause "Simplified" License
3.71k stars 891 forks source link

game_over() cancel previous put() actions #250

Open carlcbilodeau opened 3 years ago

carlcbilodeau commented 3 years ago

Hi,

If I change a piece on the board with a chess.put() I see that the board is being changed correctly when i do a chess.ascii().

But then any call to check chess.game_over() will cancel the last put action. This problem occurred on a queen that I changed for a rook after a promotion on last row.

I bypass the problem by doing a chess.load(chess.getfen()) after each chess.put(). But this temporary fix is cpu intensive.

Many thanks for reading me.

yanush commented 3 years ago

sounds related to the bug mentioned in the docs: "The en passant square and castling flags aren't adjusted when using the put/remove functions (workaround: use .load() instead)"