Simple framework turning fen into set of hand-crafted chess position features
Installation
To install please run
pip install chevy
Basic usage
King safety features
import chess
from chevy.features import KingSafety
# https://lichess.org/analysis/2r3k1/7R/6PK/6P1/2Q5/8/8/8_b_-_-_6_73
fen = "2r3k1/7R/6PK/6P1/2Q5/8/8/8 b - - 6 73"
board = chess.Board(fen)
king_safety = KingSafety(board, color=chess.WHITE)
print(f"{king_safety.king_mobility=}")
print(f"{king_safety.castling_rights=}")
print(f"{king_safety.king_centrality=}")
print(f"{king_safety.checked=}")
print(f"{king_safety.king_attackers_looking_at_ring_1=}")
print(f"{king_safety.king_defenders_at_ring_1=}")
# + more
Pawn structure features
import chess
from chevy.features import PawnStructure
# https://lichess.org/editor/5kr1/4pp1p/1Q2q3/1PBP2p1/2P3P1/p7/4P3/1R2K1B1_w_-_-_0_19
fen = "5kr1/4pp1p/1Q2q3/1PBP2p1/2P3P1/p7/4P3/1R2K1B1 w - - 0 19"
board = chess.Board(fen)
pawn_structure = PawnStructure(board, color=chess.WHITE)
print(f"{pawn_structure.passed_pawns=}")
print(f"{pawn_structure.isolated_pawns=}")
print(f"{pawn_structure.blocked_pawns=}")
print(f"{pawn_structure.central_pawns=}")
Other common features
import chess
from chevy.features import BoardFeatures
# https://lichess.org/editor/5kr1/4pp1p/1Q2q3/1PBP2p1/2P3P1/p7/4P3/1R2K1B1_w_-_-_0_19
fen = "5kr1/4pp1p/1Q2q3/1PBP2p1/2P3P1/p7/4P3/1R2K1B1 w - - 0 19"
board = chess.Board(fen)
board_features = BoardFeatures(board, color=chess.WHITE)
print(f"{board_features.bishop_pair=}")
print(f"{board_features.fianchetto_queen=}")
print(f"{board_features.fianchetto_king=}")
print(f"{board_features.queens_mobility=}")
print(f"{board_features.open_files_rooks_count=}")
print(f"{board_features.connected_rooks=}")
print(f"{board_features.connectivity=}")
# + more
To run tests:
pytest chevy/tests
Metadata
Release files for chevy 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| chevy-0.2.2.tar.gz | 11.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| chevy-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.3 kB
Release files / chevy-0.2.2.tar.gz
| Download URL | chevy-0.2.2.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cb1db3154c5627296037343d0c3f7199f4beed0e659bcbaeacd7b299eb1b2362
|
|
BLAKE2b-256 checksum How to use checksums |
cf3b29cfd89e1acf6a808904639cabefd96ba07030f73959900afe3f023790e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.8.10 Linux/5.14.0-1042-oem
|
Release files / chevy-0.2.2-py3-none-any.whl
| Download URL | chevy-0.2.2-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2358e893416308034f187d477561997d643f490f9cb9f79e9a99417a99283d40
|
|
BLAKE2b-256 checksum How to use checksums |
19d146f24c24d1d6bbd533a15fc888f4473ef7194cdabffc8d88d45dfb9eaa2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.8.10 Linux/5.14.0-1042-oem
|