Fix Japan free jump indicator and clarify map rules - #94
Merged
Merged
Conversation
Fix the free-jump indicator showing a jump as "used" when it wasn't: playerHasUsedFreeJump previously inferred usage from network topology (countNetworks >= 2), but countNetworks only traverses a player's own cities, so any two non-adjacent owned cities looked like two separate networks even when connected via the normal map. Replace that heuristic with a log scan that only counts an explicit Build move recorded with freeJump: true, plus the authoritative player.usedFreeJump engine flag. Also reframe the Japan rules text as "one network with one free jump" rather than "two separate networks", which better matches the mechanic. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
goldjohn6
added a commit
that referenced
this pull request
Jun 16, 2026
…emen rules dialog (#95) * Fix Japan free jump: track usage explicitly, not via network topology Free-jump availability was gated on countNetworks(ownedCities) < 2 as a proxy for "has the player started a second network". But Power Grid networks connect *through* unowned cities, so a single intended network routinely shows as multiple components — wrongly hiding the free jump even though the player never spent it (Sapporo unreachable while the indicator still showed the jump as available). Prior fixes (#89, #94) layered more detection heuristics on top; this removes the proxy and relies solely on the explicit player.usedFreeJump flag. - available-moves: offer the jump whenever !usedFreeJump - undo: return the jump only when the undone build was the one that spent it (a round-1 second starting-city build, or a freeJump:true move), fixing a latent bug where undoing any normal build could hand the jump back once the network had become fully connected - remove the now-unused countNetworks import - add regression tests for both availability and post-use suppression Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * Bremen: clarify asymmetric district-cost example, drop confusing river note The flat district-cost connection rules confused players, especially the direction-dependent (asymmetric) cost. Add a short worked example to the in-game rules dialog. Also remove the "Weser and Lesum rivers can be crossed without extra cost" line: the online map shows no rivers, so the note caused confusion rather than clarity (the zero-cost crossings remain in the map data and code comments). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
goldjohn6
added a commit
to mmunson99/powergrid
that referenced
this pull request
Jun 23, 2026
Brings Mike's chooseRegions region-draft branch up to date with master (which advanced through the Japan free-jump fixes boardgamers#94/boardgamers#95 and boardgamers#96). Conflicts resolved: - engine.ts import: keep computeRegionGraph + regionPickable (Mike's new shared helpers); drop countNetworks, which master removed as unused here. - engine.spec.ts: keep both test blocks — Mike's four chooseRegions draft tests and master's Japan free-jump tests were inserted at the same spot. tsc clean, 45/45 engine specs pass, 0 lint errors. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
playerHasUsedFreeJumpinferred usage from network topology(
countNetworks >= 2), butcountNetworksonly traverses a player's owncities — so any two non-adjacent owned cities looked like two separate
networks even when connected via the normal map (e.g. JapanJune11). Replaced
that heuristic with a log scan that only counts an explicit
Buildmoverecorded with
freeJump: true, alongside the authoritativeplayer.usedFreeJumpengine flag."two separate networks", which better matches how the mechanic actually works.
Test plan
prettier --checkclean,engineeslint 0 errors,enginetests pass (36),viewerbuild succeeds