TLDR
Adding states and transitions for TURN_ROLL to TURN_ROBBER and TURN_BARTER. Added victory points to Player model and knight position to GameState. Also made appropriate frontend changes to display this info.

Main work
- Adding the new
States,Actions, andGlidesneeded for a typical roll on each player’s turn. - Restructuring
GameStatemodel to keep running list of roll results, for logging and game history features. - Adding frontend test script to go through roll process for first player.
Challenges
- There is a lot of boilerplate to add the new states and transitions. I have not gone back and refactoring my FSM design to make declarating states and transitions cleaner.
- We have a lot of game state now. Unclear if it will be reasonable to fetch this large of game state from the db once persistence is added.
- There is a lot of business logic that could be broken now by making changes without test coverage. It may be time to setup a test framework, for unit tests at least.
- Mocking in proper tests would be helpful now. Manually testing by removing RNG from the business logic is not very thorough.
Learnings
- Designing state machines can be difficult and a brain twister. Once the general framework is up though, things can move quickly and be adjusted easily.
- As an alternative to writing unit / integration tests, I could flesh out the Angular UI more and allow for manual player actions / testing through the UI. I’ll likely NOT do that though, because…
- the real game will not allow the user to play for all of the four players.
- I do not have a concrete vision for the UI design yet, meaning it would likely be reworked down the road.
- I would not be able to automate tests through the UI.