No man's land: TurnResult.unowned + release/re-claim in applyTurnResult + distinct grey map rendering (#16 P3)
- shared/protocol.ts: TurnResult.unowned (keys released this turn) + the map presentation contract (regionFillStyle / unownedTooltipLabel, hue-less grey) - shared/types.ts: required GameState.unowned (cumulative mid-game releases; [] at init, distinct from preset-unassigned regions) - server/engine.ts: applyTurnResult applies releases first (sole-owner only, never fabricating no man's land from unassigned keys), then claims against the post-release snapshot (gain on an ownerless key = re-claim); lone release is isMeaningful; prompts + user payload carry the unowned field - server/stub.ts: unchanged behavior (never releases; e2e stays stable) - server/db.ts: legacy rows load with unowned defaulted to [] - server/index.ts: create-game sets []; jump reference table includes released keys so the model can name them for re-claim - WorldMap/App: unowned prop -> visible grey + 'No man's land' tooltip - unit tests: 105 -> 127 (release/re-claim suites, presentation contract, legacy-row normalization)
This commit is contained in:
+10
-1
@@ -124,6 +124,10 @@ app.post('/api/games', (req: Request, res) => {
|
||||
events: [],
|
||||
pending: [],
|
||||
version: 1, // the first saved revision; every later mutation bumps it
|
||||
// (v0.22, #16 P3) No man's land can only arise mid-game — a fresh game
|
||||
// starts with nothing released; this list grows as the LLM releases
|
||||
// regions and shrinks as they get re-claimed.
|
||||
unowned: [],
|
||||
};
|
||||
// v0.19 (#16 P1): expand each nation's ISO_A3 country list to the region keys
|
||||
// of all its sub-regions, so ownership (and the choropleth) is at region
|
||||
@@ -235,7 +239,12 @@ app.post('/api/games/:id/jump', async (req, res) => {
|
||||
preset,
|
||||
state: game,
|
||||
items: game.pending,
|
||||
regionReference: referenceForKeys(allTerritoryKeys(game)),
|
||||
// (v0.22, #16 P3) the region reference table must also cover released
|
||||
// (no-man's-land) keys — they belong to no nation's territory, but the
|
||||
// model needs their names to re-claim them.
|
||||
regionReference: referenceForKeys(
|
||||
new Set([...allTerritoryKeys(game), ...(game.unowned ?? [])]),
|
||||
),
|
||||
validRegionKeys: validKeys(),
|
||||
// v0.21 (#16 P2): when the region-adjacency manifest loaded, hand the
|
||||
// engine the resolver — the turn then runs with the LLM's getNeighbours
|
||||
|
||||
Reference in New Issue
Block a user