Skip to main content

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

CI/CD Build & Test

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.

View Game Master on PyPI

How to install and use this package

  1. Install the package:
pip install game_master
  1. Use directly from command line:
python -m game_master --help
  1. 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

  1. Clone the repository:
git clone https://github.com/software-students-spring2025/3-python-package-apexcoders.git
cd 3-python-package-apexcoders
  1. Set up the virtual environment and install dependencies:
pipenv install --dev
  1. 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

  1. Fork the repository
  2. Create a new feature branch:
git checkout -b feature/your-feature-name
  1. Make your changes and write tests
  2. Run tests to ensure they pass:
pytest
  1. Create a pull request to the main branch
  2. Request a code review from another developer
  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

game_master-0.1.2.tar.gz (52.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

game_master-0.1.2-py3-none-any.whl (34.4 kB view details)

Uploaded Python 3

File details

Details for the file game_master-0.1.2.tar.gz.

File metadata

  • Download URL: game_master-0.1.2.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

Hashes for game_master-0.1.2.tar.gz
Algorithm Hash digest
SHA256 69de3195383229ee9234488d249f50b8108a0268f416eb9d0701efb6dc01624c
MD5 40c7316c3f8b3222dd96b3fca247ca3d
BLAKE2b-256 10a7df0c6630b2dc432de80f72d0d355f1d8fe19645076f764f070958b1e98a3

See more details on using hashes here.

File details

Details for the file game_master-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: game_master-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 34.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for game_master-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c4846df4f056f21e393c2c97246eacb1e6c968324d874f4c93e9cef07e614644
MD5 68ce0c9506d9c6afc525596b9badc55f
BLAKE2b-256 730629649930e7f5703ecf92e8cad3397d0c75c3083596aefeb832b40a004f5e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page