# 🎲 Monopoly Game Design & Operations

This section caches the current architecture, conventions, and implementation standards for the Monopoly project.

## 🚀 Architecture Overview

The game follows a polymorphic architecture based on a `Game` interface.

- **Game Controller**: `MonopolyGame` (Inherits from `Game`).
- **Modal System**: Modals (Dice, Property, Board) are also `Game` objects. When active, the main game delegates `update()` and `draw()` to `active_modal`.
- **System Constraints**: 1-bit Monochrome (ST7789/E-Ink). **RTTI IS DISABLED** (`-fno-rtti`). Use `active_modal->get_type()` for safe casting.

## 🛠️ Design Patterns

### 1. Cycle/Execute Input Pattern
To prevent accidental choices on simple 2-button hardware:
- **Button 0 (A)**: Cycles through options (increments selection).
- **Button 1 (B)**: Executes/Confirms current selection or dismisses modal.
- **Visual**: Selected items MUST be prefixed with `> `.

### 2. Centralized Rendering
- **`MonopolyBoardRenderer`**: All shared board drawing logic (40-tile perimeter) MUST live here.
- **Tile Inversion**: Highlight tiles (current position or property view) using solid black fill + white text.
- **Legibility**: Use Scale 2 (`draw_string_scaled`) for player names and primary titles. Scale 1 for details.

### 3. Logic Conventions
- **Rent Calculation**:
  - **Properties**: `tile->rent[0]` (Base).
  - **Railroads**: $25 / $50 / $100 / $200 based on owner count.
  - **Utilities**: Dice Total * 4 (1 owned) or * 10 (2 owned).
- **Modal Chaining**: Dice Modal dismissal triggers `modal_property_index` check in `MonopolyGame::update` to immediately launch the Property Modal.

## ➕ How to Implement New Features

### Adding a New Tile
1. Update `TileType` and `MONOPOLY_BOARD` in [games/monopoly/monopoly_board.h](games/monopoly/monopoly_board.h).
2. Update `MonopolyBoardRenderer.h` if a new symbol or boundary is needed.

### Adding a New Modal
1. Create `NewModalGame.h` inheriting from `Game`.
2. Register a new `Type` in [lib/game.h](lib/game.h) and override `get_type()`.
3. Use the **Cycle/Execute** pattern for input.
4. Add handling logic in `MonopolyGame::update` near where `DiceModalGame` or `PropertyModalGame` are handled.
