--- title: "Math Flasher: Addition" id: 57109 type: "computer_media" slug: "math-flasher-addition" url: "http://localhost/computer_media/math-flasher-addition/" markdown_url: "http://localhost/computer_media/math-flasher-addition.md" published_at: "2024-10-03T23:37:32+00:00" modified_at: "2026-03-30T21:19:56+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/10/58_Add.png" excerpt: "A never-ending mental arithmetic drill that flashes inverse-video feedback and keeps score only in your head — how long can you keep up?" category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 1000" slug: "ts1000" taxonomy: "post_tag" url: "http://localhost/tag/ts1000/" model: - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" genre: - name: "Education" slug: "education" taxonomy: "genre" url: "http://localhost/type/education/" media_contents: - id: 56733 title: "Timex Sinclair Public Domain Library Tape 1002" type: "computer_media" url: "http://localhost/computer_media/timex-sinclair-public-domain-library-tape-1002/" media_type: "Program" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/10/58_Add.png" media_type_tags: "Education" --- # Math Flasher: Addition This program is a simple addition drill that generates two random single-digit numbers (0–9) and prompts the user to enter their sum. It uses INK (inverse video) characters to display “WRONG” or “CORRECT” as feedback, then immediately reveals the correct answer before looping back for a new question. The random values are produced with INT(10*RND), giving operands in the range 0–9 inclusive. The program loops indefinitely via GOTO 10, providing continuous practice with no score tracking or exit mechanism. *** ## Program Analysis ### Program Structure The program is divided into clearly separated functional blocks, each occupying a distinct range of line numbers: 1. **Lines 5–60:** Title display — prints a header banner of eight asterisks. 2. **Lines 100–110:** Question generation — picks two random operands. 3. **Lines 200–220:** Question presentation and answer input. 4. **Lines 300–410:** Answer evaluation and feedback display. 5. **Lines 500–520:** Spacing and loop-back to line 10. 6. **Lines 600–700:** Save and auto-run utilities, not part of normal execution flow. ### Question Generation Lines 100 and 110 use `INT(10*RND)` to generate integers in the range 0–9 inclusive for variables `P` and `Q`. This means either operand can be zero, which is valid for a beginner drill but may produce trivial questions such as “0 PLUS 0”. ### Key BASIC Idioms - **Inverse video feedback:** “WRONG” and “CORRECT” at lines 310 and 400 are stored as inverse-video characters (`%W%R%O%N%G` / `%C%O%R%R%E%C%T`), making them visually prominent on screen without any additional PRINT AT or colour commands. - **Answer reveal:** Line 410 always prints the full equation `P PLUS Q = P+Q` regardless of whether the answer was right or wrong, so the user sees the correct result in both cases before the next question appears. - **CLS after INPUT:** Line 220 clears the screen immediately after the user types their answer, keeping the display clean before feedback is shown. - **Infinite loop:** Line 520 uses `GOTO 10` to restart from the header print rather than line 100, so the asterisk banner and “ADDITION” title are redrawn on every iteration. ### Program Flow | Lines | Action | | --- | --- | | 5 | REM label identifying program as “MATH FLASHER 1 ADD” | | 10–60 | Print “ADDITION” header and row of 8 asterisks | | 100–110 | Generate random operands P and Q (0–9) | | 200–220 | Display question, accept INPUT R, clear screen | | 300 | Branch to 400 if R equals P+Q | | 310–320 | Print “WRONG” in inverse video, jump to 410 | | 400 | Print “CORRECT” in inverse video | | 410 | Print full equation with answer | | 500–520 | Print blank lines, loop back to line 10 | ### Notable Techniques The REM at line 5 uses inverse video characters to encode the program’s title and variant identifier (“MATH FLASHER 1 ADD”), a common convention for self-documenting program libraries where multiple related programs (e.g. subtraction, multiplication) share the same structure. ### Bugs and Anomalies - There is no score counter or attempt counter, so performance cannot be tracked across questions. - The header banner is reprinted on every loop iteration (line 520 goes to 10 rather than 100), causing the screen to scroll rather than presenting a stable layout. - Lines 600 and 700 (`SAVE` and `RUN`) are unreachable during normal execution and serve only as a convenient in-listing save/restart mechanism when jumped to manually. ## Source Code ``` 5 REM %M%A%T%H% %F%L%A%S%H%E%R% %1% %A%D%D 10 PRINT "ADDITION" 20 FOR L=1 TO 8 30 PRINT "*"; 40 NEXT L 50 PRINT 60 PRINT 100 LET P=INT (10*RND) 110 LET Q=INT (10*RND) 200 PRINT P;" PLUS ";Q 210 INPUT R 220 CLS 300 IF R=P+Q THEN GOTO 400 310 PRINT "%W%R%O%N%G" 320 GOTO 410 400 PRINT "%C%O%R%R%E%C%T" 410 PRINT P;" PLUS ";Q;" = ";P+Q 500 PRINT 510 PRINT 520 GOTO 10 600 SAVE "1005%8" 700 RUN ```