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:
State,HasTurn[RoleT], andTurnState[RoleT]model states and acting roles.Colorremains the natural role type for black/white games, whileSoloRolesupports single-player sequential games without fake color semantics. 【F:src/valanga/game.py†L1-L189】 - Evaluations:
Valuecarries a score, certainty level, and optional terminalOverEventmetadata. 【F:src/valanga/evaluations.py†L31-L47】 - Game termination:
OverEventstoresoutcome,termination, and optionalwinnermetadata. 【F:src/valanga/over_event.py†L1-L99】 - 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:
PlayerProgressMessageis a Color-specific helper for per-player progress reporting. It is not part of the core generic role model. 【F:src/valanga/progress_messsage.py†L1-L13】
Installation
pip install .
The project targets Python 3.13 and has no required runtime dependencies.
Quick start
Below is a minimal example that records both a two-player terminal result and a single-player terminal result:
from enum import Enum, auto
from valanga import Color, Outcome, OverEvent
class ChessTermination(Enum):
CHECKMATE = auto()
class PuzzleTermination(Enum):
GOAL_REACHED = auto()
# Two-player result: white wins by checkmate.
checkmate = OverEvent(
outcome=Outcome.WIN,
termination=ChessTermination.CHECKMATE,
winner=Color.WHITE,
)
# Single-player result: the puzzle objective was reached.
puzzle_clear = OverEvent(
outcome=Outcome.WIN,
termination=PuzzleTermination.GOAL_REACHED,
)
print(checkmate.is_win_for(Color.WHITE)) # -> True
print(puzzle_clear.is_success()) # -> True
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.3.tar.gz.
File metadata
- Download URL: valanga-0.2.3.tar.gz
- Upload date:
- Size: 50.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49ea3f77f3d3f09b2f2c62652a3c470a249b501352e13988db29f4d35bb7efbd
|
|
| MD5 |
5471ea758aeb6e6d86fdb5238a299e95
|
|
| BLAKE2b-256 |
cab483562dc9f25a039336583ee7806414d4214fb6e47ea4c9d68c56cb00ce87
|
Provenance
The following attestation bundles were made for valanga-0.2.3.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.3.tar.gz -
Subject digest:
49ea3f77f3d3f09b2f2c62652a3c470a249b501352e13988db29f4d35bb7efbd - Sigstore transparency entry: 1154590199
- Sigstore integration time:
-
Permalink:
victorgabillon/valanga@aa2cce618992c9d849844abbeb7b77f28023a1f5 -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/victorgabillon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@aa2cce618992c9d849844abbeb7b77f28023a1f5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file valanga-0.2.3-py3-none-any.whl.
File metadata
- Download URL: valanga-0.2.3-py3-none-any.whl
- Upload date:
- Size: 36.4 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 |
84742834183a1b11de5b1abb5d614ff0ee2c57ba690e7e9365a002d4dd366c78
|
|
| MD5 |
d5fc41721caa8d25e7d9d155b5aec3ff
|
|
| BLAKE2b-256 |
bfb9251bb887f9c099dde5ccc51f7ee3c6300b608e000fc931bdd1ba12ef61f3
|
Provenance
The following attestation bundles were made for valanga-0.2.3-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.3-py3-none-any.whl -
Subject digest:
84742834183a1b11de5b1abb5d614ff0ee2c57ba690e7e9365a002d4dd366c78 - Sigstore transparency entry: 1154590201
- Sigstore integration time:
-
Permalink:
victorgabillon/valanga@aa2cce618992c9d849844abbeb7b77f28023a1f5 -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/victorgabillon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@aa2cce618992c9d849844abbeb7b77f28023a1f5 -
Trigger Event:
push
-
Statement type: