CO2402 Advanced Programming · UCLan
A four-player Monopoly simulation I wrote in C++ for a university assignment. My original source code, compiled to WebAssembly, runs in your browser. The board is driven by the program's own console output.
Four players (Hamster, Pumpkin, Dog and Jaguar) play 20 rounds on a Preston-themed board read from monopolish.txt. Everything is automatic. Each turn the program rolls a die, moves the player, and calls Land() on whichever square they reach.
It implements buying and rent, rent doubling on a full colour set, stations, bonus and penalty cards, jail, mortgaging and redeeming, bankruptcy, and a bank with limited funds.
CGame owns the board and players CPlayer money, position, properties CSquare base class, virtual Land() ├─ CProperty buy, rent, mortgage ├─ CStation £200 to buy, £10 ticket ├─ CBonus roll for a reward ├─ CPenalty roll for a fine ├─ CJail · CGoToJail └─ CFreeParking
The original Visual Studio source is compiled unchanged with clang to a 254 KB wasm32-wasi binary. A small compatibility header covers the MSVC-only calls and supplies Microsoft's rand(), so a seed gives the same game it gave on Windows.
Seed 47 reproduces the console output from my submitted report line for line. Try any other seed for a new game.
The original files from my submission, exactly as handed in.