Give the characters breakout its bricks as collision geometry

`HITTEST`, `XBRICK` and `YBRICK` are gone -- about forty lines that divided
pixels by cell sizes to recover a grid index, tested the ball's leading edge
rather than its box, and could miss a brick clipped at the corner by seven
pixels' worth of ball. In their place: sixty `SOLID` rectangles registered as the
wall is built, `COLLISION 2, BRICKHIT`, and a fifteen-line handler.

The handler reads better than what it replaces because it asks rather than
derives. `RCOLLISION(1, 1)` is which brick -- the id is the array index plus one,
so nothing is looked up. Fields 2, 3 and 4 are the way out and how far, so the
ball is pushed exactly clear instead of being restored to a remembered `OX#`/`OY#`.
Field 7 is which axis to reverse, which `TESTCELL` in the other game computes by
hand from an overlap rectangle.

`MOVEBAL` loses its two brick calls and its position backup. `KILLBR` retires the
rectangle in the same breath as clearing the array element, so the next frame
cannot hit a brick that is no longer drawn.

**A latent defect in the target prescan had to be fixed first, and `RCOLLISION`
is the first name in the language to reach it.** `src/renumber.c` walks a line
character by character looking for `GOTO`, `GOSUB`, `COLLISION` and the rest, and
checked only the character *after* a match -- so `RCOLLISION(1, 1)` found
`COLLISION` at its second character, read the `(1,` that followed as a handler
line number, and refused the whole program with "branch to line 1, which the
program did not number", naming a line that contains no branch at all. It now
requires a word boundary on both sides. The comment there was already right that
the trailing check protects `GOTOX#`; nothing protected `XGOTO#`.
`tests/unnumbered.c` covers all three shapes and TODO.md section 6 item 42
records it.

The game runs ninety seconds headless with no error line and the attract mode
scores 1320, so bricks are being found and broken through the new path.

Chapter 17 is not updated yet -- that is the other half of section 6 item 39, and
it is a bigger edit than this one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EwxGB6TdoVvZ11KQQME9cL
This commit is contained in:
2026-08-02 11:17:34 -04:00
parent fdb3421b2a
commit 9e43acc0b0
4 changed files with 121 additions and 43 deletions

20
TODO.md
View File

@@ -2352,6 +2352,26 @@ each is here so the reasoning does not have to be reconstructed.
function answering 42 at the REPL -- registered in `AKBASIC_KNOWN_FAILING_TESTS` until it
does.
42. ~~**A name that merely contains a branch verb was treated as a branch.**~~ **Fixed.** The
target prescan walks a line character by character looking for `GOTO`, `GOSUB`,
`COLLISION` and the rest, and checked only the character *after* a match:
```basic
T# = RCOLLISION(1, 1)
```
```output
? 2 : PARSE ERROR Line 2: branch to line 1, which the program did not number. Branch by LABEL, or RENUMBER first
```
`COLLISION` was found at `RCOLLISION`'s second character, the `(1,` after it read as a
handler line number, and the program was refused -- naming a line that contains no branch.
`src/renumber.c` now requires a non-alphanumeric character on *both* sides. Its own
comment was already right that the trailing check protects `GOTOX#`; nothing protected
`XGOTO#`, and `RCOLLISION` is the first name in the language to reach it.
`tests/unnumbered.c` covers all three shapes.
## 7. Filing gaps against `libakgl`
When phase 7 or phase 8 needs something `libakgl` does not have, **stop and file it** in