I'm Reading this tutorial and there are 2 definitions that confuse me :


What's is the Least significant File and Least Significant Rank ?


LSF and LSR are two ways to encode a chess board coordinate into a single integer number. LSF does that by { a1, b1, c1, ... } while LSR encodes by { a1, a2, a3 ... }.


According to the web site you cited: LSF squareIndex = 8*rankIndex + fileIndex (rank << 3 | file) LSR squareIndex = 8*fileIndex + rankIndex (file << 3 | rank) (It also shows two bitmaps showing you both cases.)

These just index each square either continuing along the ranks first or the files first. Using the rank first, lsr, you align the board more to what you imagine the chessboard to be. Using lsf, you generate pawn attack faster.

My opinion is to use lsr with the starting square being a8. This allows for faster FEN and GUI conversions.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.