Repository navigation
More speed improvements to Alien City - #524
Merged
Merged
Conversation
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.
So my agent still liked its version better. Here is an actual PR in case you want to consider its improvements, probably after more of a shakedown of your current changes. The chatty details:
Results
Measured with upstream's
scripts/bench-acity.ts, plus a small timing script for the roads display:moves()on a fresh boardWhat changed
src/games/acity-road.tsstructuralConstraints(board)function. In one pass it finds every empty lot where building would break the road, and every lot where building would cut a structure off from it.src/games/acity.tscanPlace(), the off-colour dome check and the roads display all read one cached result instead of rebuilding the road graph for every candidate lot.move(), because tests sometimes edit the board directly; upstream's distance cache works the same way.roadNetworkAfterPlacementis kept as the reference implementation.test/games/acity.test.tsstructuralConstraints()gives exactly the same answers as the reference:test/fixtures/acity-golden.tsandacity-golden-oracle.jsonroad-pinch-closedfixture, whose board has the road already split. Legal play can't produce that, so it's no longer supported.Checks
npm testpasses (2518 tests); lint and typecheck are clean.Not changed
test/fixtures/acity-bench-results.json, which records upstream's before/after numbers for their own refactor.claimWouldEndConstructionbuilds a whole new game for each claim it checks.