Skip to main content

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/undo architecture, 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: TODO: link

Quickstart

Installation

skaty is on PyPI. Install it with your favorite package manager. For example:

TODO: add to pypi

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

skaty-0.1.0.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

skaty-0.1.0-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file skaty-0.1.0.tar.gz.

File metadata

  • Download URL: skaty-0.1.0.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

Hashes for skaty-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7c66c366f8e3bfa4b3ea8431aa1900b6ef6bbe73d41c26683931966981f20171
MD5 ef2000223d4a8b8d05048c92f09ac502
BLAKE2b-256 3ac43c42d52c33c7a908887f81bd36e8fff8172ee962ece9642c4208e23fdb5f

See more details on using hashes here.

File details

Details for the file skaty-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: skaty-0.1.0-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

Hashes for skaty-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c06102d35a5e4a180c44f011cfb12ecfefb214d97e1db2a12b21d966e86659ac
MD5 975979e10a2769e1fe4676805213a02f
BLAKE2b-256 228d2da296a968a4320be8e2a88193b195daf44983b794d872d2a5458a9f61ed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page