fix(catan): improve AI resource management by prioritizing settlements over roads

The AI now waits to build a road until no settlement spots are immediately reachable. This prevents wasting resources on roads when a settlement could be built, ensuring more efficient resource accumulation for higher-cost structures.
This commit is contained in:
Brian Fertig 2026-05-23 17:44:55 -06:00
parent 58c4edf8fd
commit f9e80eaedc
1 changed files with 3 additions and 2 deletions

View File

@ -177,8 +177,9 @@ export function chooseAction(state, seat) {
return { type: 'buildSettlement', nodeId: settleSpots[0] };
}
// 4. Build a road that opens a new settlement spot or extends longest road.
if (canAfford(p, COSTS.road)) {
// 4. Build a road only when no settlement spot is already reachable.
// If a spot exists, hold resources and save up for the settlement instead.
if (canAfford(p, COSTS.road) && settleSpots.length === 0) {
const road = chooseExpansionRoad(state, seat);
if (road != null) return { type: 'buildRoad', edgeId: road };
}