Terminal Based Monopoly
Monopoly in the terminal
The final project for Cornell's 3110 OCaml course. Myself and two students: Nicolas Vega and Haashim Shah created this terminal based Monopoly Game. The game works as exactly like real Monopoly, however, Chance and Comm. Chest are not implemented.
We designed the game to be extremely robust utilizing protected modules that could only interface with each other in a strict hierarchy using specific functions to limit side effects causing errors. This standardized structure allowed for indepth testing and error handling such that the game follows a logical path to develop, modify, and debug.
Notable items: we were not allowed to use a GUI, and the project was completed over the course of six weeks.
I worked primarily on the board printer and test suite as well as helping the development of the properties class.
Board Printing
With no GUI use allowed, I was tasked with coming up with a fast way to effectively print the board each turn. I created a [grid coord tuple : property string] dictionary. This worked well because the board was hard coded and very little changed each turn. This allowed us to alter coordinates on a logical grid instead of a non-standardized board shape.
A simple loop could print each 'square' of the grid and dictionary look ups are quite fast therefore it was a great solution to the issue of not having access to a GUI.
Example: P1 moves from Go (position (31,11) in the grid) to Vermont Ave (position (31,3) in the grid). We simply update the dictionary entry with key (33,3) to have the value P1, and remove that value from thw entry with key (33,11). View video for reference.
Test Suite
I volunteered to write the required test suite as I had just read how to utilize both black and white box testing to ensure game/method correctness.
Black Box: I created many premade game states to test the possible playable games. Then I ran moves on those - checking correctness along the way.
White Box: I also tested each function individually on multitudes of input output combinations to ensure each method followed expected behavior even when not in a game state.
Finally we performed many hours of play testing, and error handle checks to ensure no side effects caused fatal crashes.