2 ms·
It is necessary to store the ability-to-castle state with each rook; attempting to keep it only attached to each king is insufficient.
by xpe 3y ago
It is necessary to store the ability-to-castle state with each rook; attempting to keep it only attached to each king is insufficient.
- skupig 3y agoThat's not what I wrote, you duplicate the king ID in the position of each castle-able rook.
- xpe 3y agoSeems like I’m not following your specific id mapping.
- teo_zero 3y agoI rhink the concept is: in the initial position you have three kings: in a1, e1 and h1. Once the left rook is moved, it will be encoded as rook and not as a king anymore. Same for the right one. If you move the king, both rooks will be encoded as rooks and not as king anymore. Decoding is easy: if there's more than one king, one must be in e1: that's the real one, the others are actually rooks.