Closed radi-cho closed 6 years ago
Resolved. The problem is in the allMoves
method, because it doesn't simulate for king checks.
The AI checks all moves and selects one of them. In the same time the black king is in check but the AI doesn't care, because allMoves
calls piece.getValidMoves(/* undefined */)
. Then the AI tries to make that turn, but the checks in game.moveSelected
don't allow this. The turn isn't made and that's it.
We can solve it by adding true
as the simulate argument of getValidMoves
.
The problem:
Check out this log to reproduce the problem: https://pastebin.com/VHgF51VW
UPDATE: How to reproduce:
Qc6