fix: carve gates into the two sealed city gardens (#5) - #41
Conversation
garden() drew a continuous border and never opened an entrance, sealing 4946 walkable cells - 2473 per garden, exactly the compounds the issue measured - behind hedges nobody could cross, while Teo claims to tend them. Following the civicSquare() pattern, each side of both hedges now has a two-cell cobble gate at its midpoint, so the flowerbeds and pond join the main walkable component. A flood-fill test from spawn asserts every interior cell is reachable.
| for (const g of gardens) { | ||
| let reachedInside = 0 | ||
| for (let y = g.y + 1; y < g.y + g.h - 1; y++) { | ||
| for (let x = g.x + 1; x < g.x + g.w - 1; x++) { | ||
| if (!M.isSolid(city, x, y) && reached.has(x + ',' + y)) reachedInside++ | ||
| } | ||
| } | ||
| t.ok( | ||
| reachedInside > 1000, | ||
| `interior of garden at ${g.x},${g.y} joins the city (${reachedInside} cells reached)` | ||
| ) | ||
| } | ||
| }) | ||
|
|
||
| test('every garden side has a carved gate in the hedge (#5)', (t) => { |
There was a problem hiding this comment.
💡 Quality: Connectivity test can't prove all four gates work
The first test only asserts that >1000 interior cells are reachable from spawn. Because a garden interior is one internally-connected region, this passes as soon as any single gate connects outward, so a gate that was mis-placed or opened onto a solid obstacle would go undetected — defeating the PR's stated goal of four open approaches. The second test checks gate cells are non-solid but never checks the cell just outside each gate is walkable. Consider asserting, per side, that both the gate cell and its immediate exterior neighbor are non-solid (e.g. for the north gate also check (cxg,y-1)), so each of the four approaches is independently verified.
Was this helpful? React with 👍 / 👎
Code Review 👍 Approved with suggestions 0 resolved / 1 findingsCarves gates into the two sealed city gardens to improve accessibility. Consider expanding the connectivity test to explicitly verify all four gates rather than just interior cell reachability. 💡 Quality: Connectivity test can't prove all four gates work📄 test/open-city-gardens.test.js:30-44 The first test only asserts that >1000 interior cells are reachable from spawn. Because a garden interior is one internally-connected region, this passes as soon as any single gate connects outward, so a gate that was mis-placed or opened onto a solid obstacle would go undetected — defeating the PR's stated goal of four open approaches. The second test checks gate cells are non-solid but never checks the cell just outside each gate is walkable. Consider asserting, per side, that both the gate cell and its immediate exterior neighbor are non-solid (e.g. for the north gate also check (cxg,y-1)), so each of the four approaches is independently verified. 🤖 Prompt for agentsOptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Important Your trial ends in 7 days — upgrade now to keep code review, CI analysis, auto-apply, custom automations, and more. Was this helpful? React with 👍 / 👎 | Gitar |
|
Merged onto current The repository runs
|
fix: carve gates into the two sealed city gardens (#5)