TLDR
Updated player model to hold number of resource cards each player has. Updated PLACE_FREE_SETTLEMENT logic so that resources are collected based on second placed settlment.

Main work
- Updating player model with a
Map<ResourceColor, Integer>field. - Updating
CatanGraphServiceto find the resources that should be collected by aSettlementgraph node. - Manipulating maps and dealing with potential null values.
Challenges
- Continuing to have to untangle enums between frontend and backend. Resources have an id value, a color, and a name all derived from their enums.
- Originally had a bug where
ResourceColor.DESERTwas causing key misses in player models, since players cannot collect theDESERTresource. Fixed with simple filter, but another stumbling block with the enum design. - Somewhat of a pain working with
ngForand key-value pairs. Needed custom method to return a list of object withkeyandvalueproperties instead of a true map structure.
Learnings
- Map structure I original assumed for finding settlements near a hexagon is actually backwards. Should have keyed my map with the settlements and had sets of hexagons as the values. I can refactor this later.
<ng-container></ng-container>can be used for directives like*ngForthat you do not want to generate a parent HTML element for (e.g., no parentdivdesired).