lichess.org
Donate

Another Atomic replay bug

http://en.lichess.org/zXVY9HjA#84

Making Rxa3 causes replay reboot (opening position). There are a couple of Atomic replay bugs listed at github (en passant and SAN ambiguity), but I do not think this is either type given at there.
After looking at various positions, I think the replay bug occurs in the following situation (assuming White is the one who wins). After removing all the exploded pieces except the Black king, does White attack (in the normal sense) the square where the Black king is/was? For instance, the Bc4 attacks Kf7 in the second example, and the Ka1 attacks Kb2 in the first. See also the made-up example below, where again Bc4 attacks the "Kf7" after the explosion. http://en.lichess.org/BQXSLzNL#8

If I can figure out if this is correct by code inspection, I will post further.
I think post #3 is more or less correct.

I believe it is a rather raucous comedy of errors. Firstly, a king explosion in Atomic does *not* have a "#" appended in the PGN (which might be an error in the PGN generation routine). This string then gets passed to 'move' in chess.js

Now *normally* move_to_san() also does *not* append "#" to a king explosion (again this incorrect IMO), as the logic at line 745 *first* makes it look at in_check(), which is typically false.

However, the function king_attacked() calls attacked() with the square of the Black king, even if it has been exploded. Thus in_check() will be true in this case, and chess.js will indeed append '#' to the move (as in_checkmate() is also true), though mostly by happenstance of numerous dodgy interactions.

So... *normally* neither the string from the PGN generator nor chess.js has a '#' on the king explosion (perhaps both are incorrect), while in the exceptional cases of this thread, chess.js has a logical glitch that ends up appending it.

My fix would be to ensure that both the PGN generation routine and chess.js are correctly appending '#' to a king explosion in all cases.

This topic has been archived and can no longer be replied to.