-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
26 lines (25 loc) · 1013 Bytes
/
utils.py
File metadata and controls
26 lines (25 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
def determine_what_piece_has_been_selected(index, board):
if (board['white_pawn'] >> index) & 1 == 1:
return 'white_pawn'
elif (board['black_pawn'] >> index) & 1 == 1:
return 'black_pawn'
elif (board['white_knight'] >> index) & 1 == 1:
return 'white_knight'
elif (board['black_knight'] >> index) & 1 == 1:
return 'black_knight'
elif (board['white_bishop'] >> index) & 1 == 1:
return 'white_bishop'
elif (board['black_bishop'] >> index) & 1 == 1:
return 'black_bishop'
elif (board['white_rook'] >> index) & 1 == 1:
return 'white_rook'
elif (board['black_rook'] >> index) & 1 == 1:
return 'black_rook'
elif (board['white_queen'] >> index) & 1 == 1:
return 'white_queen'
elif (board['black_queen'] >> index) & 1 == 1:
return 'black_queen'
elif (board['white_king'] >> index) & 1 == 1:
return 'white_king'
elif (board['black_king'] >> index) & 1 == 1:
return 'black_king'