COMP3211-MonopolyCMD
A terminal-based implementation of Monopoly developed for the COMP3211 curriculum. Designed for multiplayer hotseat play, with optional AI opponents, save/load, and a test suite.
Overview
COMP3211-MonopolyCMD is a Python project implementing the classic board game Monopoly as a command-line application. The implementation focuses on clear game logic, modular design, and testability — making it suitable as an educational assignment for learning object-oriented design and game state management.
Features
- Full Monopoly rules engine: property buying, rent, auctions, mortgages, houses/hotels.
- Chance and Community Chest decks implemented with randomized draws.
- Multiplayer support (hotseat) and simple AI opponents.
- Save and load game state to JSON files.
- Command-line UI with clear prompts and input validation.
- Unit tests covering core game logic.
Tech
- Python 3.8+
- Built-in libraries: argparse, json, random
- Optional: curses for enhanced terminal display (platform dependent)
- Testing: unittest
Installation
git clone https://github.com/754cac/COMP3211-MonopolyCMD.git
cd COMP3211-MonopolyCMD
python3 -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
pip install -r requirements.txt # if present
Usage
Run the main program to start a new game:
python main.py --players 2
Common options:
- --players N (number of human players)
- --ai (add AI opponents)
- --load saved_game.json (load a previous game)
Project Structure
- src/ - game engine modules (board, player, bank, cards)
- tests/ - unit tests for core components
- data/ - card definitions and board configuration
- main.py - CLI entrypoint
Example
Gameplay is driven by text prompts. Example turn flow:
- Player rolls dice and moves token.
- If land on unowned property, prompt to buy or auction.
- Pay rent if landing on opponent property.
- Handle special squares: Chance, Jail, Go To Jail, Free Parking.
Development & Testing
Run unit tests with:
python -m unittest discover -v
Repository
The full source code and issue tracker are available at: