8 ms·
Very interesting! But I don't quite see why you need to bother with tracking pieces and swapping them. Can't you just go by the convention that pawn 0 is the fi
by level3 11y ago
Very interesting! But I don't quite see why you need to bother with tracking pieces and swapping them. Can't you just go by the convention that pawn 0 is the first pawn you find when scanning across from a1 to h8, pawn 1 is the second pawn, etc.? Similarly for the knights, bishops, and rooks? (obviously still using the fallback when necessary)
That would eliminate the need for computing swaps while still producing the same move code for a given move in a given position.
- billforsternz 11y agoThis would work but it requires a scan of the whole board for pawn (and knight and rook) moves. I wanted (and eventually got - after a lot of mistakes along the way) a system which would use negligible CPU cycles for almost all moves.
- level3 11y agoThat makes sense. I'm probably underestimating the amount of cycles saved by your swap method.