Team course project

MachiKoro board game in C++

Shanghai University · Algorithms and Programming (autumn 2022)

A dice-driven board game in C++14 for 1-N players and AI: 15 buildings, 4 landmarks, five-colour card settlement, market purchases and win conditions.

Background

MachiKoro is a light, dice-driven strategy board game. The rules are not complicated, but there are many card types and their effects trigger at different moments — a good exercise in object-oriented modelling.

This was a team course project for Algorithms and Programming at Shanghai University in autumn 2022. We built a single-machine Windows console version in C++14, supporting 1-N human players and AI in mixed games.

Résumé summary

Stack: C++14, STL, OOP, UML, Visual Studio 2022, Git

  • Contributed to the MachiKoro core: 15 buildings, 4 landmarks, five-colour settlement, market purchases and win conditions, for 1-N human and AI players.
  • Designed a Card base class with five colour subclasses and polymorphic settlement through the pure virtual action(); used Singleton, a simple factory and Iterator to reduce coupling.
  • Refactored purchasing and settlement, fixing 10+ logic and boundary issues (yellow-card return values, out-of-range market slots, purple-card triggers, Shopping Mall bonus); implemented defensive input parsing and autonomous AI decisions.

What we built

  • 15 buildings + 4 landmarks, with complete settlement rules across five card colours
  • Card hierarchy: an abstract Card base class and five subclasses, with action() as a pure virtual function
  • Turn flow: roll dice -> red -> blue/green -> purple -> build one building
  • Two market modes: origin uses all 15 buildings; dlc randomly draws 10
  • AI play: the AI can roll, choose the number of dice, re-roll and buy on its own
  • Defensive input: regex parsing, single-line input, bounds/funds/duplicate checks

My contribution

As a team member I worked on core development and debugging, mainly:

  • the card hierarchy and polymorphic settlement
  • the purchase flow and boundary checks
  • the AI action candidate set
  • input parsing and documentation

Outcome

The project compiles and runs as a complete game, with mixed human/AI play. Besides the source code, the repository keeps the UML class diagram, course notes, demo videos and the legacy prototype, documenting how it evolved from coursework into a maintainable project.

Source and full documentation: https://github.com/yicongl1/Machikoro

Technical notes

01 Modelling a board game in C++: cards and polymorphic settlement The Card base class, five colour subclasses, the action() context, settlement order and landmark modelling. 02 Edge cases in a board-game program: purchases, indices and AI PurchaseCode semantics, validate-before-mutate, invalidated slot indices, legal AI actions and input parsing. 03 From coursework to a maintainable project: refactoring and archiving Problems in the legacy prototype, the refactoring order, UML/notes/demo archiving, and what I would change next time.

Related skills

  • C++
  • Git
  • Project management