Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,56 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
---
|
| 4 |
+
|
| 5 |
+
# Dataset Card for stockfish-debug
|
| 6 |
+
|
| 7 |
+
## Columns
|
| 8 |
+
|
| 9 |
+
The datase contain the following columns:
|
| 10 |
+
|
| 11 |
+
- **fen:** The FEN string of the board.
|
| 12 |
+
- **move:** The move that was played.
|
| 13 |
+
- **result:** The result of the game (with `"-"` for unfinished games).
|
| 14 |
+
|
| 15 |
+
## Data details
|
| 16 |
+
|
| 17 |
+
Pre-processing of the Stockfish games provided by [BlueSunflower/chess_games_base](https://huggingface.co/datasets/BlueSunflower/chess_games_base).
|
| 18 |
+
|
| 19 |
+
Code used:
|
| 20 |
+
```python
|
| 21 |
+
import jsonlines
|
| 22 |
+
import chess
|
| 23 |
+
import tqdm
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def preprocess_games(in_path, out_path):
|
| 27 |
+
with jsonlines.open(in_path) as reader:
|
| 28 |
+
with jsonlines.open(out_path, "w") as writer:
|
| 29 |
+
for obj in tqdm.tqdm(reader):
|
| 30 |
+
state_action = []
|
| 31 |
+
parsed_moves = [m for m in obj["moves"].split() if not m.endswith(".")]
|
| 32 |
+
board = chess.Board()
|
| 33 |
+
for m in parsed_moves:
|
| 34 |
+
fen = board.fen()
|
| 35 |
+
move = board.push_san(m)
|
| 36 |
+
state_action.append({"fen": fen, "move":move.uci()})
|
| 37 |
+
outcome = board.outcome()
|
| 38 |
+
if outcome is None:
|
| 39 |
+
result = "-"
|
| 40 |
+
else:
|
| 41 |
+
result = outcome.result()
|
| 42 |
+
writer.write_all([
|
| 43 |
+
{**sa, "result":result} for sa in state_action
|
| 44 |
+
])
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
## Use the Dataset
|
| 48 |
+
|
| 49 |
+
Using basic `dataset` code:
|
| 50 |
+
|
| 51 |
+
```python
|
| 52 |
+
from datasets import load_dataset
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
dataset = load_dataset("Xmaster6y/stockfish-debug")
|
| 56 |
+
```
|