Chess Programming, Board Representation - Python

310 views Asked by At

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

There are 1 answers

3
eligolf On

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.