A Stateless Russian Roulette Python Engine
Project description
risiko-engine
A Stateless Russian Roulette Python Engine
📖 Table of Contents
🚀 Installation
pip install risiko-engine
🎯 Quickstart
Here's a quick example of how to use risiko-engine to simulate a game of Russian Roulette:
from risiko import RisikoState, processors
from risiko.core import PlayerBase, ShellBase
# Initialize the game state
state = RisikoState()
# Add a player to the game
state = processors.add_player_to_game(
game_state=state, player=PlayerBase(id="player1", name="Player 1", charges=3)
)
# Load the magazine with shells
state = processors.load_magazine(
game_state=state,
round=[
ShellBase(shell_type="live", damage=1),
ShellBase(shell_type="blank", damage=0),
ShellBase(shell_type="live", damage=1),
ShellBase(shell_type="blank", damage=0),
],
)
# Shuffle the magazine
state = processors.shuffle_magazine(game_state=state)
# Load a shell into the shotgun
state = processors.shotgun_load_shell(game_state=state)
# Get the current player
current_player_id = state.turns.current_player_id
print(f"Current player: {current_player_id}")
# Fire the shell
fired_shell, state = processors.fire_shell(game_state=state, shooter_id=current_player_id)
print(f"Fired a {fired_shell.shell_type} shell!")
# Check the player's health
player = state.player.get_player(current_player_id)
print(f"{player.name} has {player.charges} charges remaining.")
Note: Will be publishing it's documentation
📜 License
This project is licensed under the MIT License - see the LICENSE file for details.
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 risiko_engine-1.0.0.tar.gz.
File metadata
- Download URL: risiko_engine-1.0.0.tar.gz
- Upload date:
- Size: 22.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac7cfbfc6439589dffe0a1af0f41cc7990a66e8a6d04ebcfcb0fa8f77d361881
|
|
| MD5 |
18d35ab60256f2d29fd451076d00cc82
|
|
| BLAKE2b-256 |
a4f529bb0ca4bd01f0d7166c27e46a1366bcb1ace3549f13e31c8d6374c4bf69
|
File details
Details for the file risiko_engine-1.0.0-py3-none-any.whl.
File metadata
- Download URL: risiko_engine-1.0.0-py3-none-any.whl
- Upload date:
- Size: 22.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be32f3ed0b3a6e7cbde8873afd9f184acda7dc1b32bd6eb20c5387d00b159d7e
|
|
| MD5 |
7d82526d04616797a7a64b34c83f55d6
|
|
| BLAKE2b-256 |
cb7f05e61373c7cc296377d5f5ec45f880a4cb5e68bdb4352c211fe868536bc2
|