Shared types and utilities for evaluation
Project description
valanga
Shared Python types and lightweight utilities for describing turn-based games and their evaluations. The package exposes protocols for representing states, outcomes, and state representations that other libraries can build on.
Key concepts
- Game primitives:
Color,BranchKey,State, and related protocols describe whose turn it is, how to enumerate legal branches, and how to copy or advance a state. 【F:src/valanga/game.py†L14-L95】 - Evaluations:
FloatyStateEvaluationcaptures heuristic scores whileForcedOutcomerecords a definitive result plus the line of play that forces it. Both are grouped underBoardEvaluation. 【F:src/valanga/evaluations.py†L13-L43】 - Game termination:
OverEventcombines how a game ended with who won, backed byHowOverandWinnerenums. Utility helpers likeis_over()andget_over_tag()simplify downstream checks. 【F:src/valanga/over_event.py†L8-L115】 - State representations:
ContentRepresentationdefines how to turn aStateinto evaluator input, andRepresentationFactorybuilds or updates those representations from states and modifications. 【F:src/valanga/represention_for_evaluation.py†L9-L22】【F:src/valanga/representation_factory.py†L7-L55】 - Progress reporting:
PlayerProgressMessagecommunicates per-player progress percentages during long-running work. 【F:src/valanga/progress_messsage.py†L9-L18】
Installation
pip install .
The project targets Python 3.13 and has no required runtime dependencies.
Quick start
Below is a minimal example that marks a finished game and obtains an evaluation structure:
from valanga import ForcedOutcome, OverEvent
from valanga.over_event import HowOver, Winner
# A checkmate where white wins.
over_event = OverEvent(how_over=HowOver.WIN, who_is_winner=Winner.WHITE)
# Record the forced outcome and the line of optimal moves that lead to it.
forced = ForcedOutcome(outcome=over_event, line=["e2e4", "e7e5"])
print(forced.outcome.get_over_tag()) # -> OverTags.TAG_WIN_WHITE
To wire in a custom state representation, supply callables to RepresentationFactory that know how to build representations from a State and its modifications.
Development
Install the development dependencies and run the test suite:
pip install -e '.[dev]'
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file valanga-0.2.1.tar.gz.
File metadata
- Download URL: valanga-0.2.1.tar.gz
- Upload date:
- Size: 50.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d494713d631e8f2d8a84c06bf11569e81d9af9744d41001032325ebb8aee18b9
|
|
| MD5 |
3d9559b136f0b857aff7d72b9549fd65
|
|
| BLAKE2b-256 |
e36c96006fd3524da6c39389830d715fe416f553654715529c98bcc208f46f01
|
Provenance
The following attestation bundles were made for valanga-0.2.1.tar.gz:
Publisher:
release.yml on victorgabillon/valanga
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
valanga-0.2.1.tar.gz -
Subject digest:
d494713d631e8f2d8a84c06bf11569e81d9af9744d41001032325ebb8aee18b9 - Sigstore transparency entry: 1066537083
- Sigstore integration time:
-
Permalink:
victorgabillon/valanga@60c01e37fe9f7d490bb5d3bbe447b47380bfa292 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/victorgabillon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@60c01e37fe9f7d490bb5d3bbe447b47380bfa292 -
Trigger Event:
push
-
Statement type:
File details
Details for the file valanga-0.2.1-py3-none-any.whl.
File metadata
- Download URL: valanga-0.2.1-py3-none-any.whl
- Upload date:
- Size: 37.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
766c8928c6b894f1f4a3d55fdc02a7d239e319b7a73a1cbf755678d42ec52d88
|
|
| MD5 |
5aed3c82a4161853ae17dd077ef6c42d
|
|
| BLAKE2b-256 |
1f0b5824bdb7e93c1f398af8f04b1aae26b29a578ce8494a82987bd554efe3be
|
Provenance
The following attestation bundles were made for valanga-0.2.1-py3-none-any.whl:
Publisher:
release.yml on victorgabillon/valanga
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
valanga-0.2.1-py3-none-any.whl -
Subject digest:
766c8928c6b894f1f4a3d55fdc02a7d239e319b7a73a1cbf755678d42ec52d88 - Sigstore transparency entry: 1066537088
- Sigstore integration time:
-
Permalink:
victorgabillon/valanga@60c01e37fe9f7d490bb5d3bbe447b47380bfa292 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/victorgabillon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@60c01e37fe9f7d490bb5d3bbe447b47380bfa292 -
Trigger Event:
push
-
Statement type: