Multi-player and multi-action Rock, Paper, Scissors game client.
To install, run the following commands:
pip install rock-paper-scissors-py
# or
[email protected]: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
# or use astral/uv
uv venv --python 3.13
. ./.venv/bin/activate
Install from requirements.txt
pip3 install -r requirements.txt
# or
uv add -r requirements.txt
To import, type
import rps
Set the number of actions allowed in the game
action_three = 3 # rock, paper, scissors
action_five = 5 # rock, paper, scissors, Spock, lizard
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 = [RandomActionPlayer(name) for name in random_player_names]
Set the game and play
game = rps.Game(random_players, action_three)
game.play()
Run the example.py
in the root directory
python example.py
# or
uv run example.py
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.