3 ms·
You can use duplicate king identifiers to represent castling available, and replace the extra rook identifiers with "black king (my turn)" and "white king (my t
by skupig 3y ago
You can use duplicate king identifiers to represent castling available, and replace the extra rook identifiers with "black king (my turn)" and "white king (my turn)" to store the turn in the same amount of space.
edit: You can then use the inverted/flipped board trick to store one bit of your piece list, down to 191 bits.
edit2: You only need one "king (my turn)" ID, which represents the whichever color you didn't use for the other king. You can use the extra value for another "my turn" piece that also sets a bit. 190 bits!
- xpe 3y agoIt 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.