-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chess input representation v2.8 (#125)
* added material count feature * added get_plane_statistics.ipynb * added C++ implementation for inputs 2.8 * added C++ unit tests
- Loading branch information
1 parent
4872f78
commit d4c45d2
Showing
6 changed files
with
254 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
129 changes: 129 additions & 0 deletions
129
DeepCrazyhouse/src/preprocessing/get_plane_statistics.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Get Plane Statistics (Unit-Test Preparation)\n", | ||
"\n", | ||
"* file: get_plane_statistics.ipynb\n", | ||
"* brief: Allows investigating the board planes and their statistics. These can later be used e.g. for unit-tests.\n", | ||
"\n", | ||
"* author: QueensGambit\n", | ||
"* contact: johannes.czech@cs.tu-darmstadt.de\n", | ||
"* versions:\n", | ||
" * 2021-05-30 initial version" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"%load_ext autoreload\n", | ||
"%autoreload 2\n", | ||
"%reload_ext autoreload" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import sys, os\n", | ||
"sys.path.insert(0,'../../../')\n", | ||
"import os\n", | ||
"import sys\n", | ||
"import chess\n", | ||
"import logging\n", | ||
"from DeepCrazyhouse.src.preprocessing.pgn_to_planes_converter import PGN2PlanesConverter\n", | ||
"from DeepCrazyhouse.src.runtime.color_logger import enable_color_logging\n", | ||
"from DeepCrazyhouse.src.domain.variants.input_representation import board_to_planes, get_planes_statistics\n", | ||
"enable_color_logging()\n", | ||
"logging.getLogger().setLevel(logging.WARNING)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"b = chess.Board(\"r3k1nr/pbp4p/p2p2pb/4P3/3P4/N2q1n2/PPP2PPP/5K1R w kq - 0 14\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"get_planes_statistics(b, True, [])" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"b = chess.Board()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"b.push_uci(\"e2e4\")\n", | ||
"b.push_uci(\"c7c5\")\n", | ||
"b.push_uci(\"d2d3\")\n", | ||
"b.push_uci(\"a7a6\")\n", | ||
"b.push_uci(\"e4e5\")\n", | ||
"b.push_uci(\"d7d5\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"b" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"get_planes_statistics(b, False, [chess.Move.from_uci(\"d7d5\")])" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.7.6" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.