TLDR
Implementing the getAvailableSettlementIndices method in CatanGraph, so that the system can validate where Settlement pieces can be placed. Manually testing the implementation logic by manipulating the CatanGame object directly with hardcoded values.
Sketching out some ideas for identifying possible settlement locations.

Notice below that the debugger shows Settlement indices that the red player could place a settlement at.

Main work
- Writing the graph logic within
getAvailableSettlementIndices. - Coming up with test casesto gain confidence in the graph logic / implementation.
Challenges
- My first idea for how to approach the graph logic was too complicated.
- I thought iterating through each of the user’s roads would be efficient and relatively easy, but I later settled for a brute force check of every settlement location.
- The implementation I came up with would be very hard for someone else to follow. Keeping for now and assuming I will do sweeping refactoring once system is working (hobbling along).
- Can certainly make the graph logic much simpler if I redesigned the data structure and created some specific helper methods. This would require a holistic review / re-design of the system, which I do not have time for.
- Java is (too?) verbose!
Learnings
- I will certainly design / use graph data structures differently in the future. The overhead of accessing / filtering elements within my graph is too high, both from a compute / efficiency standpoint and a cognitive load standpoint.
- I think the main issue revolves around keying my supporting
Mapvariables by bothGraphNodeandGraphNodeIndexat times. - I also think I should have used composition rather than inheritence for each graph element. That would let me check piece types (e.g.,
HexagonvsRoad) more easily during iterations. - Another poor decision was letting the graph be sparse. I should have built the entire graph and possibley had a field like
isOccupied. This would avoid a lot of redundant logic I’ve been using to check if a board space is occupied by a player.
- I think the main issue revolves around keying my supporting