Files
akbasic/docs/images/breakout-game.png

5 lines
3.4 KiB
Plaintext
Raw Normal View History

Rewrite the two game tutorials as instructions rather than commentary Chapters 17 and 18 read as a code review of a finished listing: they explained why each decision had been made, walked through the project's own history, and led with what had once been broken. A reader who wanted to build the game got the reasoning and had to reconstruct the program. Both are now step-by-step. Each opens with a picture of the finished game and a bullet list of the steps, each bullet is a section, and each section states its goal, shows the code, and says how to check it. Chapter 17 is sixteen steps and Chapter 18 is thirteen, and the last of each is the assembly: the order of the file, the full declaration block, and the routines the earlier steps referred to. Project history is gone -- it belongs in Chapter 14 and in git -- and where a listing has to do something awkward, the tutorial shows how first and names the `TODO.md` item that will make it unnecessary second. **Three defects had no entry anywhere**, which the rewrite found by trying to state each rule as a rule. §6 item 35: `a - b + c` computes `a - (b + c)`, because `subtraction()` sits above `addition()` as its own precedence level and the inner loop eats the `+`. Item 36: only one unparenthesised `AND` or `OR` is matched, which is item 12's `if`-where-`while` on the one operator pair item 12 did not reach. Item 37: a `GOTO` out of a `FOR` or a `DO` leaks the loop's scope, so a main loop written that way stops on the thirty-second lost life -- which is why both games are built out of `LABEL` and `GOTO`, and it is a workaround rather than a preference. Chapter 3 gains the identifier rule the third trial ran into: there is no underscore in a name, and the error says `UNKNOWN TOKEN _`. **`tools/screenshot.c` learned to draw the text layer**, behind a new `text=1` fence attribute, because Chapter 17's game is characters in the grid and a figure without that layer is two sprites on black. It opens the bundled font at the size the standalone frontend uses, so a figure's cell size is the reader's cell size, and it uses the akgl sink alone rather than a tee so the program's output lands in the picture instead of on the stdout the caller reads to decide a figure failed. Both new figures -- `breakout-game.png` and `breakout-game-artwork.png` -- are generated from listings in the chapters like every other one. Verified by handing each chapter, alone, to an agent on a much smaller model and telling it to build the game from the tutorial text with the `examples/` tree off limits. The first pass scored 3.5 and 3 out of 10 and named what was missing: routines referred to but never shown, the third level layout, the sprite `DATA`, the font table, edits to earlier routines that were never marked as edits. Those are now in. The second pass built a 658-line Chapter 17 game that plays itself for ninety seconds with the score at 1890 and no error line, and the third built a 1053-line Chapter 18 game with 61 labels, no invented routines, no gaps found, and forty seconds clean. 9/10 and 8/10. One real bug in the new prose, caught in review: Chapter 18's `HITBAR` did not set the `HIT#` that `BALLPADDLE` reads to decide whether the paddle already caught the ball. Both suites green in both configurations, `docs_examples` and `docs_screenshots --check` pass. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EwxGB6TdoVvZ11KQQME9cL
2026-08-02 08:08:23 -04:00
<EFBFBD>PNG

IHDR X' lIDATx<54><78><EFBFBD>э<EFBFBD>6<06><>pe<70><65>t<EFBFBD><12>AJ_΃<17>p<EFBFBD><70><EFBFBD>99<><39>=<04>o$<24><>w<EFBFBD>Ԉ<EFBFBD><1F>]<5D><>|<7C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˩<EFBFBD><CBA9><1E><><EFBFBD><EFBFBD>+<2B><><EFBFBD>l|>˿<><CBBF>1<<3C><><EFBFBD><2<><EFBFBD>y<EFBFBD><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD>~>[<5B><><EFBFBD>-<2D><>5<35>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD>]<5D>~<7E><1F>=<00>&~^<5E>4<EFBFBD><19><><EFBFBD><EFBFBD>Gr<47><72>G=<3D>Q<EFBFBD>|<7C>#<23><1C><1E><>ȿ<EFBFBD><C8BF>+<1A>]Xa<58><61>|_F<5F><46><15>m<EFBFBD><6D><EFBFBD><EFBFBD><EFBFBD>w<EFBFBD><77>Y<EFBFBD><59><EFBFBD>j<EFBFBD><6A><EFBFBD>`<04><><EFBFBD>u<EFBFBD>uy<><79><EFBFBD>35<33>.Z<><5A><EFBFBD>ս<><D5BD>[<5B><>e<EFBFBD><65>߯}~O<><4F><EFBFBD><EFBFBD><EFBFBD>:<3A>6<EFBFBD><36>˕<EFBFBD><CB95><EFBFBD><EFBFBD>vQ<07>x<EFBFBD><78><EFBFBD><0E>8<EFBFBD>yF<79><46>9<EFBFBD>!<21><>K<EFBFBD><4B><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Y<EFBFBD><59>y<EFBFBD><79><EFBFBD>V<EFBFBD><73><DEAD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+W<>}<1F><>χq<CF87><71>̚<EFBFBD>j\<5C><>S<EFBFBD>[0:ψ<>/<2F>ϓ<EFBFBD><CF93><EFBFBD><=<3D><>t<EFBFBD><00>]<5D><06><><EFBFBD><1F>\uR<75>a<EFBFBD><61><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͸gY<67>}<7D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>q<EFBFBD><71><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>8y<38>VG<56><47><1B>y<EFBFBD><79><EFBFBD><EFBFBD><EFBFBD>&Q<>z<7A><7F><EFBFBD><EFBFBD><<3C><><EFBFBD><EFBFBD><EFBFBD>6<>>X<><58>s<EFBFBD>~>8<><38>X<EFBFBD><58>q<EFBFBD>DZ<EFBFBD>:F<><46><EFBFBD>s<EFBFBD><73>:V^<5E>Z<EFBFBD><5A>ˑ<EFBFBD>gt<67><00>]:y,_<>pe}<7D>N<EFBFBD><4E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>j<><6A><EFBFBD><EFBFBD>=<3D><>zG<7A><47><EFBFBD><EFBFBD>f|޷<><DEB7><EFBFBD>(*O<>}<7D>ߞχ<11><><EFBFBD>ϫk><0F>i<EFBFBD><69><EFBFBD>ף<EFBFBD><D7A3>}f<><66><EFBFBD><6B><D68F>P<><50><EFBFBD><10>ﳢ^<5E>z<EFBFBD><7A>իW<D5AB>O<EFBFBD><4F>`<00>V<EFBFBD><56>R<EFBFBD>^<5E>z<EFBFBD><7A>ի<0F><> <00> =f<07><><EFBFBD>|<7C><><EFBFBD><EFBFBD>ǯ<EFBFBD>r<EFBFBD><<3C>k<EFBFBD><6B><EFBFBD>yZ<79><5A>/?ޚ<><DE9A>^<5E><><EFBFBD><EFBFBD>yZ<79><5A>/?ޚ<><DE9A>^<5E><><EFBFBD><EFBFBD>yZ<79><5A>̿<EFBFBD><1F><00><><EFBFBD><EFBFBD>V<><56>,<2C><>X<EFBFBD>u<EFBFBD>Y<EFBFBD><59>K<EFBFBD><4B><EFBFBD><EFBFBD>K<EFBFBD><4B>z<EFBFBD>ߕ@<40><><EFBFBD>މ<EFBFBD>g<EFBFBD><67>kF<6B><79>A<><41><EFBFBD>A<><41><EFBFBD>z<><7A>@ <20>5X<35>x;<78><CDBE>
c<04><><EFBFBD>!<21><>=<3D><>g:X<00><><EFBFBD><EFBFBD>f?<3F>-?<3F><>kF<6B><46><EFBFBD>f<04><>kF<6B>9<EFBFBD>t<><00>Y<EFBFBD><59><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E597BF><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><5F><EFBFBD>`<04><><EFBFBD><EFBFBD><EFBFBD>ܼ<EFBFBD>|<7C><><EFBFBD><EFBFBD><EFBFBD><7F>?C϶<43><CFB6>g<EFBFBD><67>V<EFBFBD><56> <0C><>`<00>V<EFBFBD><56><10><><EFBFBD><EFBFBD><EFBFBD>9<EFBFBD>k<EFBFBD>¨<EFBFBD><C2A8>Z/<><7F><EFBFBD><<3C><><EFBFBD><EFBFBD>o<><6F>Z/<><7F><EFBFBD><<3C><><EFBFBD><EFBFBD>o<><6F>Z<EFBFBD>f<EFBFBD>X<><10>U<EFBFBD>_V<5F>e<EFBFBD>+<2B>n;<3B><>s<EFBFBD>?<3F><>s<EFBFBD>?WO<57><4F><EFBFBD><EFBFBD>6<36>;QͽCF<43><46>k<EFBFBD>7<EFBFBD>f<04><>kF<6B><46><EFBFBD>f<04><>kF<6B><46><EFBFBD>f<EFBFBD><66>l;<3B><>f <0A>7<EFBFBD><EFBFBD><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><1E>˿3,<00>`[OB<4F><42>Ö<EFBFBD><C396><EFBFBD><EFBFBD>5#<23>__3<5F><33><EFBFBD>5#<23><>:X<00><><EFBFBD><EFBFBD>F<EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD>C~<7E>{<7B>/<2F><>t<EFBFBD><00><>`}Yan<61>s<EFBFBD>\<5C>~<7E><><EFBFBD>ߟ<EFBFBD>g[<5B><>3<EFBFBD>l+^t<>`+[_pv<70>x<EFBFBD><73>8<EFBFBD><38>3<EFBFBD><33><EFBFBD>G<EFBFBD><47>\?<3F><><EFBFBD><EFBFBD><EFBFBD>v˿k<><00><><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD>;<3B><>n;<3B><>s<EFBFBD>?<3F><>s<EFBFBD>?WO<57><4F><EFBFBD><EFBFBD><08><>U<EFBFBD>f><3E>:<><7F><EFBFBD>C<EFBFBD>r<EFBFBD>h<EFBFBD><68><EFBFBD>G<EFBFBD><47>\?<3F><><EFBFBD><EFBFBD>Ѳ<EFBFBD><D1B2>K <20>V<><56><EFBFBD><EFBFBD>j<EFBFBD>{<7B><><EFBFBD>.<2E><><EFBFBD><EFBFBD><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><08><>U%<25>9l<39><6C><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD>M<>r<EFBFBD>h<EFBFBD><68><EFBFBD>G˞?/,<00>`:XU<58><55>Ö.<2E><><EFBFBD>.<2E><>ʞ?/,<00>`:X_<58>g<EFBFBD>W<EFBFBD>.<2E><>m<EFBFBD><6D><EFBFBD>г<EFBFBD><D0B3><EFBFBD>z<><7A><EFBFBD>?C϶<43><CFB6>g<EFBFBD><67>6c<36><63><EFBFBD><EFBFBD><00><><EFBFBD>X <20><><73><DEAB>?<3F>#,<2C><><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD>m<><6D><EFBFBD><EFBFBD>,<00>`<60>"<22><><15>rZ<72>|<7C><>,<2C><>%<25>\<5C><>Փ<EFBFBD>5<EFBFBD>`<04><><EFBFBD>B<EFBFBD><EFBFBD>\?<3F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>=?<3F><>`<04><><EFBFBD>B<EFBFBD>.<2E><><EFBFBD><EFBFBD><7F><EFBFBD><EFBFBD>E <20><0E><16><>!<21><>\?<3F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>=?<3F><>`<04><><EFBFBD>B<EFBFBD>5<04><>%<25>\<5C>ϕ=?<3F><>`<04><><EFBFBD><EFBFBD><EFBFBD>Y<EFBFBD>վK<D5BE>u[<5B><>3<EFBFBD>l+<7F><7F>m<EFBFBD><6D><EFBFBD>гm<D0B3><6D><EFBFBD>I <00><>b<EFBFBD><62><EFBFBD><EFBFBD>ٯ<EFBFBD><D9AF><EFBFBD>,O<><4F>٭<EFBFBD>z<EFBFBD><7A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>j<EFBFBD><6A><08>*›X<C29B>(<28><>^<5E>g<EFBFBD><67>ғ?<3F><><EFBFBD><EFBFBD>=v<7F><76>?{~֤<><10> <20> @0k<30><6B><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.<2E><>gϟ]<5D><>Ϟ<EFBFBD>Yt<59><00><>`m!<21><><EFBFBD>gϟ]<5D><>Ϟ?<3F><><EFBFBD><EFBFBD>=?<3F><>`3<>f<><10><1A><>8^<5E><><EFBFBD>wi<77>n<EFBFBD>1v<7F><76>?{<7B><ECB28F><7F><EFBFBD>I <00><>vLs<4C><73>`<60>5w<><77><EFBFBD>j<EFBFBD><6A>5O<35><4F>٭<EFBFBD>zW<7A><03>`s!KX<4B>(<28><><EFBFBD><EFBFBD><EFBFBD>$<24><><67><CF9F><EFBFBD>w:X<00>L<EFBFBD><00><>`<04><06>jVT<56><54><EFBFBD>Xa<58>H<16><>?{<7B><><EFBFBD>?{<7B><><08><>E<02>G<EFBFBD><47>nce<1F><><EFBFBD><EFBFBD>3<EFBFBD><33>I <20> @0,<00>`<60>`<60><><EFBFBD>uC<75>}<7D><><0E><><EFBFBD><7F><EFBFBD>x<7F><78> y<><00><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?><3E><><EFBFBD><EFBFBD><EFBFBD>Vw<56>]<5D><>c<01><>!,<2C>}v<>b<EFBFBD><05><><EFBFBD><EFBFBD>wc<77><10> <20>E <0C><>,r<07><>!$<24>6 G<>n<><6E>?<3F><><1D><><7F><EFBFBD><EFBFBD>@0W3<>f<><10> <20> <00>x<EFBFBD><0E><15><>g<EFBFBD>_<1F>_ b<>[<5B>z<EFBFBD><7A><EFBFBD><EFBFBD>U<EFBFBD><55>[<5B><>l<EFBFBD><6C>ʞ<5<>Uv<55><76><EFBFBD>Y<EFBFBD>ֽ<EFBFBD>l{V<13><><EFBFBD><EFBFBD><1E>+<2B><><0F><>cv<00><><EFBFBD>9;W{?~<7E><><EFBFBD><08><><EFBFBD>L<EFBFBD><4C><EFBFBD>}<7D><><EFBFBD><EFBFBD>z<EFBFBD>__<5F>ޱ<EFBFBD><DEB1>1<><31>Z<EFBFBD>&<26>߯<EFBFBD>ԏ<D48F><7F>|<7C>Ŝ;>@,,<00>`:X,<2C><><EFBFBD>}<7D>Q<EFBFBD><51><EFBFBD>]= ]<5D><>\<5C>1<EFBFBD>Y<EFBFBD><59><EFBFBD><EFBFBD> w<><77>Lk;<3B><>֭ײ<D6AD>_%<25>z<EFBFBD><7A>?(<>U<EFBFBD><55><EFBFBD><EFBFBD>c<EFBFBD><63><EFBFBD>l<EFBFBD><6C><EFBFBD><EFBFBD>=?<3F>C <20><0E>vz<76><1A><><EFBFBD>ή<EFBFBD>;[<13>Z<EFBFBD><5A><EFBFBD><EFBFBD><EFBFBD><EFBFBD>эе*<2A>f<EFBFBD><66><EFBFBD><EFBFBD>F<EFBFBD><07><>`<04><><EFBFBD><1B><EFBFBD><13><>uEY<45>-e<><65>g},<2C>@0,<2C><><EFBFBD><EFBFBD>j<EFBFBD>a<EFBFBD>NW<11>{Uc<55>V<EFBFBD><56><1C><11>w<EFBFBD><77>7`,<08>/1<0F>]cGE<47>IEND<4E>B`<60>