|
1 | | -# monopoly-cpp |
2 | | -The Repository for the C++ Project. Here we implement monopoly in a CLI Application. |
3 | | -For the correct display of the gameboard it is recommended to use a monospace font. |
| 1 | +# Monopoly C++ (monopoly-cpp) |
4 | 2 |
|
5 | | -## Deviations from the base game |
| 3 | +A command-line implementation of Monopoly in C++, designed to be played through a Text User Interface (TUI). This project is built for educational purposes and aims to simulate the classic board game with a custom set of features and rules. |
6 | 4 |
|
7 | | -The game was implemented largely as originally designed. |
8 | | -A few small rulechanges where applied with limited impact on the gameplay. |
9 | | -- Cards referencing "move to nearest railroad" do not require you to pay double the rent price, calculation is based on normal rent calculation |
10 | | -- Cards referencing "move to nearest utility" do not require you to pay 10x rolled die as rent price, calculation is based on normal rent calculation |
11 | | -- when bankrupt, there is a menu to try to raise cash. Selling streets in this part is not implemented. |
12 | | -- when bankrupted by the bank, the streets are returned to the bank and are not immediatly auctioned of. |
13 | | -- when bankrupted by a player, the player is not forced to immediatly pay 10% interest on the properties. |
| 5 | +## Recommendations |
| 6 | + |
| 7 | +For optimal display of the gameboard, use a **monospace font**. Without a monospace font, the board might appear misaligned. |
| 8 | + |
| 9 | +## Compatibility |
| 10 | + |
| 11 | +This project was developed and tested on Linux. Due to hardware limitations, testing on macOS was not performed. |
| 12 | + |
| 13 | +### Windows Compatibility: |
| 14 | +Windows may encounter issues with UTF-8 characters in the console. While it may work depending on fonts and terminal settings, some symbols might not display correctly. |
14 | 15 |
|
15 | 16 | ## Compile Instructions |
16 | 17 |
|
17 | | -The project was build and tested on linux with the following compile command: |
| 18 | +To compile the game, follow these instructions: |
18 | 19 |
|
19 | | -``` |
| 20 | +### Using g++ (Linux): |
| 21 | + |
| 22 | +```bash |
20 | 23 | g++ monopoly.cpp -o monopoly --std=c++11 |
21 | 24 | ``` |
22 | 25 |
|
23 | | -Furthermore CMake is available and tested with linux and the following compile commands: |
| 26 | +### Using CMake (Linux): |
| 27 | + |
| 28 | +1. Create a build directory: |
| 29 | + |
| 30 | + ```bash |
| 31 | + mkdir build |
| 32 | + cd build |
| 33 | + ``` |
| 34 | + |
| 35 | +2. Run CMake: |
| 36 | + |
| 37 | + ```bash |
| 38 | + cmake .. |
| 39 | + ``` |
| 40 | + |
| 41 | +3. Build the project: |
| 42 | + |
| 43 | + ```bash |
| 44 | + cmake --build . |
| 45 | + ``` |
| 46 | + |
| 47 | +## How to Play |
| 48 | + |
| 49 | +Upon starting the game, you'll be prompted to input the number of players. After that, each player is assigned a name, symbol, and color. The turn order is randomized, and each player takes their turn. |
| 50 | + |
| 51 | +### Example Menu: |
24 | 52 |
|
25 | 53 | ``` |
26 | | -cmake -S . -B build |
27 | | -cmake --build build |
| 54 | +Do you want to load last saved game? |
| 55 | +┌────────┬────────┐ |
| 56 | +│ 1: YES │ 0: NO │ |
| 57 | +└────────┴────────┘ |
28 | 58 | ``` |
29 | 59 |
|
30 | | -Windows support is not available due to an utf-8 encoding issue with the player model. |
| 60 | +Here, entering "1" will load the last saved game, while entering "0" starts a new game. |
| 61 | + |
| 62 | +### Player Setup: |
| 63 | + |
| 64 | +Each player chooses a name, symbol, and color. The color will be used to highlight the player's position on the gameboard. |
| 65 | + |
| 66 | +### Turn Sequence: |
| 67 | + |
| 68 | +1. The turn order is randomized. |
| 69 | +2. Each player takes their turn, and during the turn, they can perform various actions like moving, buying properties, or paying rent. |
| 70 | +3. The game continues in this way until a player wins or all players agree to quit. |
| 71 | + |
| 72 | +## Load and Save |
| 73 | + |
| 74 | +* **Saving**: The game automatically saves when quitting, and there is a failsafe that ensures the game will save if invalid input is given. |
| 75 | +* **Loading**: You can load a previously saved game if all the necessary `.csv` files (like `Players.csv`, `Tiles.csv`, etc.) are located in the same folder. |
| 76 | + |
| 77 | +## Deviations from the Original Base Game |
| 78 | + |
| 79 | +While the game closely follows the rules of Monopoly, a few small deviations were implemented to enhance the gameplay experience: |
| 80 | + |
| 81 | +* **Railroad and Utility Cards**: In the original game, players are required to pay double the rent or 10x the rolled die amount when landing on certain cards. In this version, we calculate rent using the standard rules. |
| 82 | +* **Bankruptcy and Cash Raising**: When a player goes bankrupt, there is an option to try to raise cash, but selling properties to other players is not yet implemented. |
| 83 | +* **Free Parking**: When landing on the "Free Parking" space, players receive money accumulated in the parking. This is a **house rule** commonly used in Monopoly but is not part of the original rules. |
| 84 | + |
| 85 | +## Missing Features |
| 86 | + |
| 87 | +The following feature is not yet implemented: |
| 88 | + |
| 89 | +* **Player vs. Bot Mode**: AI-controlled bots are not available, as developing a competitive AI for Monopoly is complex. A purely random decision-making AI could lead to repetitive or boring gameplay. |
| 90 | + |
| 91 | +## Files |
31 | 92 |
|
32 | | -## Missing features |
| 93 | +The following files are part of the project: |
33 | 94 |
|
34 | | -There is no implementation for player vs bot since it is not easily feesible to implement with the broad decision needed to give any challange in this case. |
35 | | -A pure random generator for doing actions and accessing menu's is not a good idea. |
| 95 | +* **monopoly.cpp**: Contains the main game loop and logic for playing the game. |
| 96 | +* **FileImport.hpp**: Handles loading data from CSV files (e.g., game board, player data). |
| 97 | +* **FileExport.hpp**: Handles saving data to CSV files. |
| 98 | +* **player.hpp**: Defines the `player` struct and methods for player setup and actions. |
| 99 | +* **tile.hpp**: Defines the `tile` struct and methods for setting up the game board. |
| 100 | +* **card.hpp**: Defines the structures and functionality for Community and Chance cards. |
0 commit comments