Skip to main content

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:

Metadata

Release files for rock-paper-scissors-py 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rock-paper-scissors-py 0.1.4
File Size Uploaded
rock_paper_scissors_py-0.1.4.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rock-paper-scissors-py 0.1.4
File Interpreter ABI Platform
rock_paper_scissors_py-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 11.7 kB

Release files / rock_paper_scissors_py-0.1.4.tar.gz

Download URL rock_paper_scissors_py-0.1.4.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ce025f4059ec845ce0b6fd6ea3ba40c439996ca9d3398ffd2db8a414f0718a1e
BLAKE2b-256 checksum
How to use checksums
f176f417d4d810dc4e01346c29aee30d71b89e4acd840288d4afc56850206378
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 29, 2025.

Transparency log

Release files / rock_paper_scissors_py-0.1.4-py3-none-any.whl

Download URL rock_paper_scissors_py-0.1.4-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae4c584ea1a25a86ff9e2e22f3d387f70619262f6b18c97f849079715ff9b4d6
BLAKE2b-256 checksum
How to use checksums
5bd0ce1609c0d75bb2043a5ede94f9956fb9d65814e4a38751ec109b5c95c0c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 29, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page