The woods and the highway keep to the flat cap #136
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "task/3621-the-woods-and-the-highway-keep-to-the-fl"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Tracker: #3621
Step 4d of plan #3558 (D4): no drawn land at y ≥ 0 lies inside a water or lake tile. #3620 put the land's waterline, flat cap and bank on the land tiles; this step holds the woods cap and the highway to that flat cap, along their segments and over their triangles, not only at their vertices.
What changes
FlatCapindexes the flat cap's outline, the land loops' lips, by tile. Each tile is marked as wholly on the cap, wholly off it, or holding some of its outline, so a run far from the coast costs one lookup per segment.signedAreadoes.hold(ring)returns the pieces of the region on the ring's left that lie on the cap, by the even-odd rule, each as a ring of its own. Each piece runs along the ring while it lies on the cap. From where the ring leaves the cap, it runs forward along that lip, through its corner vertices, to where the ring next comes back onto the same lip. This pairs each exit with an entry the way polygon clipping does, so a ring that spans a pinch, where two land loops part, gives one piece on each loop's cap. A ring wholly off the cap holds to nothing.forestLoops): it takes theFlatCapand returns every held piece of each outline.buildSurfacebuilds oneFlatCapfrom the land loops it is given, and the woods and the highway share it.Tests
forestLoopssegment, sampled every 0.05 along it, lies inside the flat cap, to 1e-3;holdover hand-built caps, each checked on a 0.01 grid against the ring ∩ the cap (offCap): a ring that leaves the cap and comes back holds to the part of it on the cap, along the lip between; a ring that spans a pinch holds to one piece on each land tile's cap.offCapputs on the cap. A point within 0.004 of a triangle's edge, or off the cap by no more than 0.004, is not compared. The pinch map runs this check, and so does a test over the generated islands. It compares 2.63M points that either highway draws, 2.58M of them covered, and takes 3 s on m5./server/import under src/client,generateIslandincluded, so the test sits beside #3620's generated-island surface tests.offCapin src/mock/islands.ts: an even-odd test over the lips by rows, with the distance to the outline when a point lies off it. It shares no code withFlatCap.Evidence
The review of
f861a51(run 375), answered atc035227ribbondraws every piececap.holdreturns (test coverage).c035227adds the coverage check above to src/mock/island.test.ts. It is a test-only change, so the benches and renders below stand for this head and were not rerun.git archivecopy ofc035227, ribbon's loop overcap.hold(…)was cut tocap.hold(…).slice(0, 1). contour.test.ts, src/mock/island.test.ts and src/client/render then failed exactly the two coverage checks, and passed the other 200 of 202 tests.sak-gate fullrun 5 atc035227passed:npm test895/895 in 26.2 s, andtest:phone180/180 in 200.7 s.fast1 and 2 failed on craft's two-gunship landing test, andfull3 on that test and hud-css's text contrast. Run 4 wasfullatc035227, failing on the craft test alone while run 389's sxfullgate ran beside it.git archivecopies, failed the same 7 tests on timeouts.The review of
656519d(run 349), answered atf861a51A highway over a pinch (finding 1): the review's 8×8 map, two land blocks meeting only at the corner (4,4), with a road turning at (3,3) shifted by
encodeShift(s, s). Each road triangle was sampled on a 1/20 barycentric grid and measured withoffCapandwetDepth.656519d: most off the cap656519d: samples in water (deepest)f861a51Each exit pairs with an entry on its own lip (findings 1 and 2):
holdfollows the lip forward by the cap's side, not the shorter way round, and returns each piece as its own ring.git archivecopy of the head, walking the lip backward fails both newholdtests in contour.test.ts in under a second. The first has 9,009 grid points apart, and the pinch test fails too.656519ddid, fails the pinch test (1 piece instead of 2, 1,899 points apart) and the island.test.ts pinch test (2,076 samples off the cap).nearestand the null exit and entry are gone (finding 3). A ring's pieces now break only where it meets the outline, at a hit that carries its place on the outline. So every exit and entry has a place by construction.The held geometry equals the unheld geometry ∩ the cap. Both probes ran by scanline on a 0.05 lattice, skipping points within 0.004 of an outline.
forestLoopsagainst itself with aholdthat keeps each ring as it is, ∩ the lips. 0 mismatches over 393M lattice points on the 96 maps ofgeneratedIslands(), and 0 over 97M on 23 partly known maps (64² and 128², 3 or 8 random known disks each). The backward-walk mutant gives 93M mismatches.Fuzzing: 3,000 tries each hold a random triangle up to 3 tiles across over a random 10×10 map with random shifts, checked against ring ∩ cap on a 0.02 grid. A try with no land or a degenerate triangle is skipped. The head fails none, and 723 of its triangles give more than one piece.
656519dfails 299.The drawing is unchanged on the yard's islands: seed 68 (the coast views) and seed 42, Island and Land, at 128² with Lakes 0.25. The head's woods cap and highway cover the same lattice points as 656519d's in every layer, with a few triangles fewer (6,843 against 6,851 at seed 68). So the renders below, made at
656519d, stand for the head.Rebuild cost (Shore yard, Playwright WebKit, iPhone 15 landscape, on m5): 5 sessions × 7 interleaved runs per arm, 140 pages with no page error, from
git archivetrees built by vitebuild()and served bypreview(). Each figure is the median of the runs' rebuild means, in ms:672fc28, with the head's shore.tsb76502d656519d, the reviewed headf861a51WOODS_SHADE = 0.9, because main's ground.ts does not export it.The Map Yard frame bench was not rerun. The head draws the same coverage as
656519don the yard's islands, as shown above, and its figures at656519dfollow below.Gates at
f861a51(m5):sak-gate fullrun 1 passed:npm test894/894 in 21.9 s, andtest:phone180/180 in 193 s.Measured at
656519dBase checks: the base b76502d's geometry, measured with the same sampling and
offCap: 8,681 of 73,850forestLoopssegments leave the flat cap, up to 0.606, and 11,917 woods-cap and 3,546 highway triangles within a tile of the water have edges off it. On the head, none.waterin every finish and view: 8 to 40 water and wrapped-corner points beside the woods and the highway draw as land per view. The head passes it.Mutation checks (
git archivecopies of the head, each running contour.test.ts and island.test.ts):forestLoopswithouthold: the woods segment test fails on 12,560 samples, and the triangle test on 2,223 triangles.holdand without the woods' turn through the lip's corner vertex: the segment test fails on 41,387 samples, the triangle test on 6,452 triangles, and the hand-built wrapped-corner test fails too. Withoutholdalone, the turn still puts the vertex there, so that test passes.Renders: the woods and highway views at 1× and 0.5× in every finish with
&grid, reduced motion, iPhone 15 landscape, from builds ofb9556de(#3619's base, main's drawing),b76502d(the base, #3620's drawing) and the head.Partly explored maps, which the tests above do not cover (they use fully known maps): 46 maps (128² Island Lakes 0.25, 128² Land Lakes 1, 64² Island Lakes 1 and 64² Land Lakes 0.25, at seeds 1–6, each known in 3 or 8 random disks of radius 6–26). None of 124,451 woods-cap and highway triangles, each sampled on a 1/20 barycentric grid, lies off the flat cap.
Rebuild cost on s32: the Shore yard rebuild took 24.67 ms on main, 16.53 ms on the base
b76502dand 20.20 ms on656519d. Where 656519d's extra over the base went, in Node at 256² seed 42:new FlatCapabout 1.1 ms;forestLoopsfrom 2.3 to 4.1 ms, of whichholdover the woods' 94 rings and 5,000 points was about 1.1 ms; and the highway's hold of 162 of its 19,450 quads, 324 triangles, about 1 ms.Map Yard bench (src/bench/map.ts, WebKit iPhone 15 landscape, on s32): 5 sessions × 7 interleaved runs, base
b76502dagainst head656519dat rest, and the head with?doom=battle,?doom=battle&spare,?doom=nukeand?doom=nuke&spare. Medians of 35 runs, ms a frame:The step changes no play, so the AI matches and the net bench were not run.