An extensible Skat implementation with reference implementation for International Skat Order
Project description
skaty
An extensible, high-performance Skat implementation in Python.
It provides a robust core engine and includes a reference implementation of the International Skat Order (ISkO).
Features
- ISkO compliant: strict adherence to official rules
- Extensible: easily implement house rules
- AI-Ready: built with fast, allocation-friendly
apply/undoarchitecture, making it perfectly suited for reinforcement learning - Type Safe: Fully typed and designed for modern Python
Documentation
A comprehensive documentation covering architecture, tutorials and API references can be found here.
Quickstart
Installation
skaty is on PyPI. Install it with your favorite package manager. For example:
pip install skaty
Usage - Random game
skaty separates the rule set from the game state. First instantiate a rule set (e.g. the International Skat Order defined by skaty) and then pass it to the game state.
The from_random_deal method requires the dealer index (either 0,1, 2) to determine player positions. Setting log=True will print information to the console.
import random
from skaty.isko.rules import ISkO
from skaty.isko.state import ISkOGameState
rule_set = ISkO()
dealer = random.randint(0,2)
game = ISkOGameState.from_random_deal(rule_set, dealer, log=True)
The GameState.get_valid_actions(player_idx) iterator method yields all legal actions for a given player in the current game state.
Below is a complete example of simulating a random game until it reaches game over.
import random
from skaty.isko.rules import ISkO
from skaty.isko.state import ISkOGameState
from skaty.rules import GamePhases, GameTypes
rule_set = ISkO()
dealer = random.randint(0,2)
game = ISkOGameState.from_random_deal(rule_set, dealer, log=True)
print(f"Player {dealer} deals.")
while game.phase != GamePhases.GAME_OVER:
active_p = game.active_player
actions = list(game.get_valid_actions(active_p))
action = random.choice(actions)
game.apply_action(action)
if game.game_type == GameTypes.PASS:
print("Game was passed")
else:
# If an ISkO game is not passed, it needs to have a declarer.
print(f"Game ended in phase {game.phase} with score {game.calculate_game_score()[game.declarer_idx]} for player {game.declarer_idx}")
For more information about ISkO or implementing your own rules, consult the documentation.
Testing
Tests are written with pytest.
Run them with:
poetry run pytest
Contributing
Contributions are welcome! If you find a bug or want to improve performance, feel free to open an issue or submit a pull request.
License
MIT License, see License file.
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 skaty-0.1.1.tar.gz.
File metadata
- Download URL: skaty-0.1.1.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.14.3 Darwin/25.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fb83f5fa340886a5a9d3ba731b0e71db34bfbf36e0dd0ccd901c92ddac819b3
|
|
| MD5 |
f971dab6416b3f655742a82133ce76f8
|
|
| BLAKE2b-256 |
4f11e798dc2430f57b5c026b853f8951bcbf1181f82220be179a43e916988df9
|
File details
Details for the file skaty-0.1.1-py3-none-any.whl.
File metadata
- Download URL: skaty-0.1.1-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.14.3 Darwin/25.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3cdf7b834f0bed84cff65fcc2c1c28d8175bfb1fd41950e7aa72539b36edd352
|
|
| MD5 |
cf613d205c60b43575b20420663b071c
|
|
| BLAKE2b-256 |
319eb677f200e56a46a12db183870882eeefae1f3d684890ff4f64337633a17e
|