Back to Projects

Game of Pig

A fun turn-based dice game built with Python

2024
Python
Game Development

About the Project

Game of Pig is a classic dice game implementation that combines strategy with chance. Players take turns rolling a single die, accumulating points with each roll. However, rolling a 1 ends your turn and you lose all points for that turn! The first player to reach the target score wins. This project demonstrates object-oriented programming principles and game logic implementation in Python.

Key Features

Turn-Based Gameplay

Strategic dice rolling with risk/reward decisions on every turn

Score Tracking

Real-time score updates and turn point accumulation

Customizable Rules

Set your own winning score and number of players

Multiplayer Support

Player vs Player mode for competitive gameplay

CLI Interface

Clean command-line interface with clear prompts and feedback

Strategic Decisions

Balance risk vs reward - when to roll again or bank your points

Technologies Used

Python 3.x OOP Random Module Game Logic

Game Rules

The Game of Pig follows simple yet strategic rules:

Project Highlights

This project showcases clean Python code with modular design, implementing game state management and player interaction through a command-line interface. The code is well-documented and follows PEP 8 style guidelines, making it easy to understand and extend.

What I Learned

Developing this game strengthened my understanding of Python fundamentals, particularly in areas like game state management, input validation, and creating engaging user experiences in a CLI environment. I learned how to structure code for readability and maintainability while implementing game logic that balances simplicity with strategic depth.