I am programming a chess ai. I ran into a problem when I want to move the bits from the king_span to the left. When I move the bits up to 45 places, it works fine. If I want to move them more than 45 places, the outputed bitboard is the same, as if it only moved by 45 places. Why is it not moving them any further and how could I possibly fix the problem? Do I have to make a second king_span for this?
Thanks for trying to help me.
king_span = int("0000000000000000000000000000000000000000000001110000010100000111", 2)
def print_bitboard(bitboard):
board = '{:064b}'.format(bitboard)
for i in range(8):
print(board[8 * i + 0] + " " + board[8 * i + 1] + " " + board[8 * i + 2] + " " + board[8 * i + 3] + " " + board[
8 * i + 4] + " " + board[8 * i + 5] + " " + board[8 * i + 6] + " " + board[8 * i + 7])
print_bitboard(king_span << 45)
Output:
1 1 1 0 0 0 0 0
1 0 1 0 0 0 0 0
1 1 1 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
--> Bits don't move further. The next bitboard should look like this:
1 1 0 0 0 0 0 0--> this bit gets deleted to zero
0 1 0 0 0 0 0 0--> this bit gets deleted to zero too
1 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0