I really thought it only restricted jumps. Thanks for putting this up!
King Capture Bug with Pinned Piece & Check
Would there be a way to contact chess.com and tell them about this bug or is chess.com just not caring anymore about variants ?
Would there be a way to contact chess.com and tell them about this bug or is chess.com just not caring anymore about variants ?
The original thread by LongTermFuture was deleted. I'm re-describing this so I have something to link to.
Normally in spell chess, capturing the opponent king is allowed even if it would leave you in check. However, there is a bug that prevents the king capture in the specific situation where:
Consider this (silly) simple position with White to move:
The bug usually comes up when wanting to take the king with a jump, but the conditions for the bug are unrelated to jumps.
The technical reason for this behavior is in how the variants client precomputes pinned piece restrictions. When the position is changed by a move or spell, the code looks for pinned pieces and notes the direction in which they are pinned. It also sets an allowBreakPin property to record where captures (of a king) would have to occur to allow moving off the pin line. It should be possible to break a pin if you're capturing the king of the player putting you in check and you are not in check from anyone else (in 4-player variants). There is another variable for which players are putting you in check from which pieces. This is a JavaScript object where the property names (keys) are player IDs. Unfortunately, JavaScript property names are always technically strings even though player IDs are usually stored as numbers. The allowBreakPin logic (to make sure you're capturing the right player's king) uses the === operator to compare player IDs to property names from the checking players variable. This comparison always fails: the text "2" is not the same as the number 2. allowBreakPin therefore never gets filled in if you are in check.