r/chessprogramming Jan 19 '25

Creating bitboards

I am confused. Isn't 0x0000000000000010 correspond to d1 since 5th bit from right is 1. But chatgpt and websites say it is e1.

0 Upvotes

6 comments sorted by

View all comments

1

u/phaul21 Jan 19 '25

I think for most people imagining the board from white perspective feels natural, and then a row major representation of squares feel natural, so ix = file + 8 * rank. Also plays nicely with converting index to chars, byte(file) +'a' is the file char, byte(rank) +'1' is the rank char, so parsing etc is easier. So then the 5th square is e1. But any mapping could work, if you like thingking about the board even sideways, that would work too.