Multi-player and multi-action Rock, Paper, Scissors game client
Project description
rock-paper-scissors-py
Multi-player and multi-action Rock, Paper, Scissors game client.
Installation
To install, run the following commands:
pip install rock-paper-scissors-py
# or
git@github.com:jwc20/rock-paper-scissors-py.git
cd rock-paper-scissors-py
To use the engine, first setup and activate a python virtual environment (venv)
python3 -m venv .venv
. ./.venv/bin/activate
Install from requirements.txt
pip3 install -r requirements.txt
Usage:
In your Python file, to import, type
import rps
Set the number of actions allowed in the game (beats logic will be generated based on the number of actions)
action_three = 3 # rock, paper, scissors
# => BEATS = {
# 0: [2], # Rock beats Scissors
# 1: [0], # Paper beats Rock
# 2: [1], # Scissors beats Paper
# }
action_five = 5 # rock, paper, scissors, Spock, lizard
# => BEATS = {
# 0: [2, 3], # Rock crushes Scissors & Lizard
# 1: [0, 4], # Paper covers Rock & disproves Spock
# 2: [1, 3], # Scissors cuts Paper & decapitates Lizard
# 3: [1, 4], # Lizard eats Paper & poisons Spock
# 4: [0, 2], # Spock vaporizes Rock & smashes Scissors
# }
Set the players with either fixed or random actions
player_jae = rps.FixedActionPlayer("Jae", 0) # always plays Rock, like an idiot
# bunch of random players with random actions
random_player_names = [f"random{i}" for i in range(20)]
random_players = [rps.RandomActionPlayer(name) for name in random_player_names]
Set the game and play
game = rps.Game(random_players, action_three)
game.play()
Example
Run the example.py in the root directory
python example.py
Note
Game consists of m players and n actions where m >= 2 and n >= 3 and n is an odd number.
Actions are hand gestures played by the players (rock, paper, scissors).
If the number of actions set in the game is between 5 and 15, the game uses the rules made by Sam Kass and David C. Lovelace.
See also:
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
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 rock_paper_scissors_py-0.1.4.tar.gz.
File metadata
- Download URL: rock_paper_scissors_py-0.1.4.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce025f4059ec845ce0b6fd6ea3ba40c439996ca9d3398ffd2db8a414f0718a1e
|
|
| MD5 |
43979dfb67dae2e17b88108a668bde54
|
|
| BLAKE2b-256 |
f176f417d4d810dc4e01346c29aee30d71b89e4acd840288d4afc56850206378
|
Provenance
The following attestation bundles were made for rock_paper_scissors_py-0.1.4.tar.gz:
Publisher:
python-publish.yml on jwc20/rock-paper-scissors-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rock_paper_scissors_py-0.1.4.tar.gz -
Subject digest:
ce025f4059ec845ce0b6fd6ea3ba40c439996ca9d3398ffd2db8a414f0718a1e - Sigstore transparency entry: 323705022
- Sigstore integration time:
-
Permalink:
jwc20/rock-paper-scissors-py@0521e670e176a671a6e60247546b0d17d78e59bf -
Branch / Tag:
refs/tags/v.0.1.4 - Owner: https://github.com/jwc20
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@0521e670e176a671a6e60247546b0d17d78e59bf -
Trigger Event:
release
-
Statement type:
File details
Details for the file rock_paper_scissors_py-0.1.4-py3-none-any.whl.
File metadata
- Download URL: rock_paper_scissors_py-0.1.4-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae4c584ea1a25a86ff9e2e22f3d387f70619262f6b18c97f849079715ff9b4d6
|
|
| MD5 |
774713e267b4cdf774a862e58f0ddead
|
|
| BLAKE2b-256 |
5bd0ce1609c0d75bb2043a5ede94f9956fb9d65814e4a38751ec109b5c95c0c6
|
Provenance
The following attestation bundles were made for rock_paper_scissors_py-0.1.4-py3-none-any.whl:
Publisher:
python-publish.yml on jwc20/rock-paper-scissors-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rock_paper_scissors_py-0.1.4-py3-none-any.whl -
Subject digest:
ae4c584ea1a25a86ff9e2e22f3d387f70619262f6b18c97f849079715ff9b4d6 - Sigstore transparency entry: 323705043
- Sigstore integration time:
-
Permalink:
jwc20/rock-paper-scissors-py@0521e670e176a671a6e60247546b0d17d78e59bf -
Branch / Tag:
refs/tags/v.0.1.4 - Owner: https://github.com/jwc20
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@0521e670e176a671a6e60247546b0d17d78e59bf -
Trigger Event:
release
-
Statement type: