3.7e) When a pawn reaches the rank furthest from its starting position it must be exchanged as part of the same move on the same square for a new queen, rook, bishop or knight of the same colour. The player’s choice is not restricted to pieces that have been captured previously. This exchange of a pawn for another piece is called ‘promotion’ and the effect of the new piece is immediate.
def piece_delta(board: chess.Board, count: int, piece_count: Dict[int, int],
colour: bool) -> Tuple[int, int, int]:
piece_position = (0, 0, 0)
for key, value in piece_count.items():
current_count = bin(board.pieces_mask(key, colour)).count('1')
if current_count < value: # Detects lost based on previous state
piece_position = (key, uci_to_1d_array_index(board.peek().uci()), count)
piece_count[key] = current_count # Modify by object-reference
break
elif current_count > value: # Accounts for promotion
piece_count[key] = current_count # Modify by object-reference
piece_count[chess.PAWN] = bin(board.pieces_mask(chess.PAWN, colour)).count('1') # Account for pawn count change
break
return piece_position # piece id, position, count
board.pieces_mask(chess.PAWN, chess.BLACK)
/ | < | > | ||||||
---|---|---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
1 | 1 | 1 | 1 | 1 | 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 | 0 | 0 | 0 |
$ wc -l *
3502985 ficsgamesdb_2000.pgn
...
11126076 ficsgamesdb_2020.pgn
452107755 total
$ du -h ./
17G
$ ls | wc -l
21
$ wc -l *
178 Aachen1868.pgn
...
1196 Zurich2015.pgn
1786360 total
$ du -h ./
64M
$ ls | wc -l
1059
…We collect around 3,000,000 different chess positions played by highly skilled chess players and label them with the evaluation function of Stockfish, one of the strongest existing chess engines. We create 4 different datasets from scratch that are used for different classification and regression experiments. …
doi:10.5220/0006535502760283
- Stockfish
- Strongest currently
- Traditional
- FOSS
- Leela Chess Zero
- Self-taught through reinforcement learning and repeated self-play
- FOSS
- AlphaZero
- First engine to use reinforcement learning and self-play
- Propriety
- Komodo
- Propriety
- Used by
Chess.com
for it’s celebrity bots
Source code: https://github.com/Jake-Moss/chess-analysis
Broke git once on Mar 7, 2021.
Everything was written in Emacs.