Monopoly is a simplified, terminal-based reimplementation of the classic board game, written in Python using the Textual library. Roll dice, buy “computer components” instead of properties, pay rent, draw Chance/Risk cards, and aim to bankrupt your opponent or collect a full set of components.
- Project Overview
- Requirements
- Installation
- Running the Game
- How to Play
- Game Rules
- Repository Structure
- Built with Textual to run entirely in your terminal.
- Two players take turns rolling dice and moving around a board of 22 fields.
- Instead of classic properties you buy “computer components”: Network Card, RAM, GPU, HDD, CPU.
- Special fields include:
- Start: Collect $200 each time you pass.
- Chance: Draw a random event card.
- Risk: Face a random gamble.
- Neostrada: Choose how many spaces (1–16) to move.
- Python 3.8 or higher
- Dependencies listed in
requirements.txt:textual=3.4.0
-
Clone the repository:
git clone https://github.com/karol157/monopoly.git cd monopoly -
(Optional) Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate # Linux/macOS venv\Scripts\activate # Windows
-
Install dependencies:
pip install -r requirements.txt
Start the game with:
python main.pyA Textual interface will launch in your terminal, displaying the board, dice panel, and sidebar with player info.
-
Rolling the Dice
- Press Enter (or select “Roll the dice”) in the bottom panel.
- The dice result and your new position will appear.
-
Purchasing or Passing
-
Landing on a purchasable field shows Buy and Pass buttons in the sidebar.
- Buy: Pay the field price and add it to your assets.
- Pass: Skip buying; the next player may still purchase this field later.
-
-
Special Fields
- Start: Receive $200 each time you pass from position 16 back to 1.
- Chance & Risk: Draw a random card that may move you, adjust your money, or skip turns.
- Neostrada: Enter a number (1–16) to move manually.
-
Paying Rent
- If you land on an opponent’s owned component, pay the displayed rent.
- Owning multiple of the same type doubles the rent.
-
Ending the Game The game ends when either:
-
A player goes bankrupt (has zero or negative cash), or
-
A player collects one of each of the five component types:
- Network Card
- RAM
- GPU
- HDD
- CPU
-
monopoly/
├── game/
│ ├── board.py # Main Textual app and board logic
│ ├── field.py # Field (property) definitions
│ ├── player/
│ │ ├── model.py # Player UI widget
│ │ └── player.py # Player class (state, cash, position)
│ ├── dice.py # Dice widget and turn queue
│ ├── thing_info.py # Field info panel + Buy/Pass + event handling
│ ├── chance_and_risk.py # Chance and Risk card definitions
│ ├── number_input.py # Manual-move screen (Neostrada / cards)
│ └── win.py # Victory / endgame screen
├── src/ # Textual CSS style sheets
├── main.py # Entry point to launch the game
└── requirements.txt # Python dependencies