0

Saw this style of board representations and was wondering what kind of style this is? Bit-board or 0x88? Im newer to programming and even newer to Chess programming so this Board representation choice seemed a bit different than the array versions that seem more straight forward. I tried searching but i wasnt able to find a description that matched. Any explanation would be appreciated.

'''
squares= 0xFFFFFFFFFFFFFFFF
filea= 0x0101010101010101
fileb= 0x0202020202020202
filec= 0x0404040404040404
filed= 0x0808080808080808
filee= 0x1010101010101010
filef= 0x2020202020202020
fileg= 0x4040404040404040
fileh= 0x8080808080808080
rank1= 0x00000000000000FF
rank2= 0x000000000000FF00
rank3= 0x0000000000FF0000
rank4= 0x00000000FF000000
rank5= 0x000000FF00000000
rank6= 0x0000FF0000000000
rank7= 0x00FF000000000000
rank8= 0xFF00000000000000
diag_to_A1H8 = 0x8040201008040201
anti_diag_H1A8 = 0x0102040810204080
lightsquare= 0x55AA55AA55AA55AA
darksqaure= 0xAA55AA55AA55AA55
'''
  • 1
    Those are just mask constants for a board that is represented as a 64-bit integer, one bit for each square. The white rooks would be at 0x80 and 0x01. – Tim Roberts Apr 21 '22 at 03:23

1 Answers1

0

This is not a board representation. These variables are bit masks that helps you extract e.g. a specific file or rank from a board. These would most likely be used as helper variables in a bitboard board representation.

eligolf
  • 1,682
  • 1
  • 6
  • 22
  • You think this would be for a 0x88 board representation or a 64-bit? – stelugo Apr 25 '22 at 18:27
  • @stelugo, this has nothing to do with board respresentation, it is just helper variables as mentioned in my answer. It could be for a normal 64 bit board, I have used similar ones. – eligolf Apr 26 '22 at 12:26
  • @stelugo, if you feel like it answered your question, then please approve this as an answer to others can benefit from it too. – eligolf Apr 27 '22 at 04:29