An entertaining Python package that helps make party games more fun by providing random game ideas, challenges, and tools for game masters and party hosts.
Project description
Game Master
An entertaining Python package that helps make party games more fun by providing random game ideas, challenges, and tools for game masters and party hosts.
Description
Game Master is a fun and lighthearted Python package designed to bring joy to your gatherings. It provides a variety of functions to help you run party games, including selecting random participants, generating game ideas, creating dares and truth questions, managing countdowns, and more.
How to install and use this package
- Install the package:
pip install game_master
- Use directly from command line:
python -m game_master --help
- Or import in your Python code:
from game_master import spin_the_bottle, random_game_idea
# Generate a random game idea for 4 players
game = random_game_idea(4)
print(game)
# Spin the bottle with a list of names
names = ["Alice", "Bob", "Charlie", "David"]
result = spin_the_bottle(names)
print(result)
Features
- Spin the bottle to randomly select participants
- Create countdown timers for game activities
- Generate random punishments for multiple players
- Suggest game ideas based on player count
- Create random dares with varying difficulty levels
- Generate truth questions with varying difficulty levels
- Randomly select who pays the bill
- Show help text with function descriptions
Installation
Install Game Master using pip:
pip install game_master
Usage
Importing in Python Code
from game_master import (
spin_the_bottle,
countdown,
random_multiple_people_punishment,
random_game_idea,
random_dare,
random_truth,
who_pays_the_bill,
show_help
)
Function Examples
Spin the Bottle
from game_master import spin_the_bottle
# Randomly select someone from a list of names
names = ["Rin", "Elena", "Tony", "Corrine"]
result = spin_the_bottle(names)
print(result) # Output: "[Name] is selected!"
Countdown Timer
from game_master import countdown
# Create a countdown timer for 30 seconds
end_time = countdown(30)
print(f"Timer ended at: {end_time}")
Random Punishment
from game_master import random_multiple_people_punishment
# Select 2 people from a list and assign a random punishment
names = ["Rin", "Elena", "Tony", "Corrine"]
result = random_multiple_people_punishment(2, names)
print(result) # Output: "[Name1], [Name2] must [punishment]!"
Random Game Idea
from game_master import random_game_idea
# Get a random game idea for 4 players
game = random_game_idea(4) # Accepts 1-5 players
print(game) # Output: A game suggestion for 4 players
Random Dare
from game_master import random_dare
# Generate a random dare with medium difficulty
dare = random_dare("medium") # Accepts "easy", "medium", or "hard"
print(dare) # Output: "[Random dare text]"
Random Truth Question
from game_master import random_truth
# Generate a random truth question with easy difficulty
truth = random_truth("easy") # Accepts "easy", "medium", or "hard"
print(truth) # Output: "[Random truth question]"
Who Pays the Bill
from game_master import who_pays_the_bill
# Randomly select someone to pay the bill
names = ["Rin", "Elena", "Tony", "Corrine"]
result = who_pays_the_bill(names)
if result.startswith("Error:"):
print(result)
else:
print(f"{result} will pay the bill!")
# Example with invalid input
invalid_result = who_pays_the_bill([])
print(invalid_result) # Output: "Error: names_list cannot be empty."
Show Help
from game_master import show_help
# Display help information about all available functions
help_text = show_help()
print(help_text)
Command Line Usage
You can also use Game Master from the command line:
# Spin the bottle
python -m game_master --bottle Rin Elena Tony Corrine
# Countdown timer
python -m game_master --countdown 30
# Random game idea
python -m game_master --game 4
# Random dare
python -m game_master --dare medium
# Random truth question
python -m game_master --truth easy
# Select who pays the bill
python -m game_master --pay Alice Bob Charlie David
# Random punishment
python -m game_master --punish 2 Rin Elena Tony Corrine
# Show help
python -m game_master --help
All commands include error handling and validation to ensure a smooth experience even with incorrect inputs.
Example Program
Here's a complete example that uses all the functions:
from game_master import (
spin_the_bottle,
countdown,
random_multiple_people_punishment,
random_game_idea,
random_truth,
random_dare,
who_pays_the_bill,
show_help
)
def run_party_night():
print("Welcome to Party Night!")
# Set up player names
players = ["Rin", "Elena", "Tony", "Corrine"]
print(f"Players tonight: {', '.join(players)}")
# Start with a game idea
print("\nLet's start with a game:")
game = random_game_idea(4)
print(game)
# Spin the bottle to pick a player
print("\nLet's see who goes first...")
chosen = spin_the_bottle(players)
print(chosen)
# Give a dare
print("\nTime for a dare!")
dare = random_dare("medium")
print(f"Your dare is: {dare}")
# Now ask a truth question
print("\nTime for some truth!")
truth = random_truth("medium")
print(f"Answer honestly: {truth}")
# Countdown for the dare
print("\nYou have 10 seconds to decide whether to do the dare or answer the truth!")
countdown(10)
# Random punishment for multiple people
print("\nTime for punishment!")
punishment = random_multiple_people_punishment(2, players)
print(punishment)
# Decide who pays for pizza
print("\nWho's paying for pizza tonight?")
payer = who_pays_the_bill(players)
if payer.startswith("Error:"):
print(payer)
else:
print(f"{payer} will pay for pizza!")
# Show help at the end
print("\nNeed more ideas? Here's all you can do:")
print(show_help())
if __name__ == "__main__":
run_party_night()
This example demonstrates how to use each function in the Game Master package to create a complete party game experience. It includes player selection, game ideas, dares, truth questions, countdowns, punishments, and bill payment selection.
You can run this example by saving it as party_night.py and executing:
python party_night.py
Development Setup
Prerequisites
- Python 3.9 or higher
- pipenv
Setup Steps
- Clone the repository:
git clone https://github.com/software-students-spring2025/3-python-package-apexcoders.git
cd 3-python-package-apexcoders
- Set up the virtual environment and install dependencies:
pipenv install --dev
- Activate the virtual environment:
pipenv shell
Testing
Run the tests with pytest:
pytest
Building the Package
Build the package using the build module:
python -m build
This will create distribution packages in the dist/ directory.
Installing Locally for Development
You can install the package in development mode:
pip install -e .
Contributing
- Fork the repository
- Create a new feature branch:
git checkout -b feature/your-feature-name
- Make your changes and write tests
- Run tests to ensure they pass:
pytest
- Create a pull request to the
mainbranch - Request a code review from another developer
- After approval, merge the pull request and delete the feature branch
Team
License
This project is licensed under the GNU General Public License v3 (GPLv3) - 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 game_master-0.1.3.tar.gz.
File metadata
- Download URL: game_master-0.1.3.tar.gz
- Upload date:
- Size: 52.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b26746637fa967f52b458c8dd825da46e011a55059ae66df4bf8c13836a74356
|
|
| MD5 |
558350d142506e2e11c34fae8d974eb5
|
|
| BLAKE2b-256 |
bf17af83d867b31558cb646711b3bb9d1693248f147aa9d4722cae38d6872f79
|
File details
Details for the file game_master-0.1.3-py3-none-any.whl.
File metadata
- Download URL: game_master-0.1.3-py3-none-any.whl
- Upload date:
- Size: 34.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be86e6cc69d9739df92c97cb8241082b84ae6ac79ad33dd49566365d06c4c7d4
|
|
| MD5 |
94be80a9af25048dced6e090baf8eb54
|
|
| BLAKE2b-256 |
1dd8eae1ad87f62177ede067095ee5026548d515ef7f892b44df74fe75a5f5aa
|