Skip to content

Pin the console representation after adding or removing locations - #86

Merged
dmccoystephenson merged 1 commit into
masterfrom
feature/pin-console-representation-after-location-changes
Nov 20, 2026
Merged

dmccoystephenson merged 1 commit into
masterfrom
feature/pin-console-representation-after-location-changes

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

  • A characterization test (Test 90) is added for Environment::printConsoleRepresentation() after the grid's location vector changes. Only a fresh grid and Grid::setSize were covered before.
    • After Grid::removeLocation on a 2x2 grid, every later location shifts back one slot, so the occupied (0, 1) is printed on the first row: "[ ] [x] \n[ ] \n".
    • After Grid::addLocation of a location at (5, 5), that location is printed after the generated four, on a row of its own: "[ ] [ ] \n[ ] [ ] \n[x] \n".
  • In the README's "Grid Layout and Movement" section, the setSize note is widened to state that the printout follows getLocations() order and ignores coordinates, so it also misaligns after removeLocation and addLocation.

No production code is changed. This is a Stage B cycle (test expansion). No open issues existed at triage, so none were skipped and none are closed. A Stage A sweep of docs/STRATA.md was done first and found no drift: the CMake minimum, the v0.7.0 pin, emsdk 6.0.11, the 16x10 golden blocks, the snap rule, the bench timing, the 12 fps fallback and the four site files were all checked against source.

Test plan

  • CI Library tests (make + CMake) runs run_tests.sh and run_tests_asan.sh green, with Test 90 printing Success. Local compilation and execution are denied in this sandbox, so CI is the anchor.
  • Expected strings traced by hand against Environment::printConsoleRepresentation, Grid::removeLocation, Grid::addLocation and Grid::addEntityToLocation.

This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).

🤖 Generated with Claude Code


drafted by Claude on behalf of Daniel Stephenson

printConsoleRepresentation walks getLocations() and breaks rows every
getSize() locations, so removeLocation shifts later locations back a
slot and addLocation's location is printed last, whatever its
coordinates. A characterization test pins both, and the README now
says so alongside the existing setSize note.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric (anchor: CI run 44667861092, the Library tests job printed Test 90 Success under both the make build and the AddressSanitizer build; Strata frontend and Web build also green):

  • Scope: PASS — only src/tests.cpp (one test plus its registration) and one README sentence are changed, both about the same behaviour.
  • Tests-new: PASS — no new public method is added; the new test exercises printConsoleRepresentation after removeLocation and after addLocation, neither of which was covered before.
  • Tests-fix: N/A — characterization only, no production code is changed.
  • Sibling structure: PASS — the test follows its neighbours: the Test N - ... / Success pair, assert(), and the existing captureConsoleRepresentation helper. It is numbered 90 after Test 89.
  • Sibling renames: N/A — nothing is renamed.
  • Docs: PASS — the README "Grid Layout and Movement" note now covers removeLocation and addLocation next to setSize. The ## Classes table is unaffected.
  • Issue resolution: N/A — no open issues existed; nothing is closed.
  • Local test suite: PASS via CI. Local compile/execute is denied in this sandbox, so CI is the anchor.
  • Header/definition parity and include guards: N/A — no header is touched.
  • Test registration: PASS — src/tests.cpp calls the new function as the last line of main(), and CI printed it.

Judgment note: README.md:58 says an added location is printed after the existing ones whatever its coordinates. Whether it begins a new row depends on how many locations precede it, so the README deliberately does not say "on a row of its own". The test only pins the fresh-grid case, where it does.

This comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit abf5064 into master Nov 20, 2026
3 checks passed
@dmccoystephenson
dmccoystephenson deleted the feature/pin-console-representation-after-location-changes branch November 20, 2026 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant