--- title: "Equations" id: 64643 type: "computer_media" slug: "equations" url: "http://localhost/computer_media/equations/" markdown_url: "http://localhost/computer_media/equations.md" published_at: "2026-03-05T20:48:06+00:00" modified_at: "2026-03-30T21:41:49+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/03/Equations-2.png" excerpt: "A simultaneous-equations quiz that generates guaranteed integer solutions and reveals them with flashing highlights — can you beat it before pressing any key?" 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 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" genre: - name: "Education" slug: "education" taxonomy: "genre" url: "http://localhost/type/education/" media_contents: - id: 64613 title: "CATS Library Tape 10" type: "computer_media" url: "http://localhost/computer_media/cats-library-tape-10/" media_type: "Program" download_url: "https://archive.org/download/timex-sinclair-software-archive/EQUATIONS%20%28198x%29%28TS2068%29%28US%29%28Program%29.zip" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2026/03/Equations-2.png" - url: "http://localhost/wp-content/uploads/2026/03/Equations.png" media_type_tags: "Education" --- # Equations This program generates random simultaneous linear equations in two unknowns and challenges the user to solve them mentally before revealing the answer. It randomly selects integer coefficients A, B, C, D and solutions X, Y (each in the range 1–10) using a user-defined function, then constructs the constant terms E and F by back-calculation, guaranteeing whole-number solutions. The solution display uses FLASH 1 to highlight the values of x and y, and verification lines show the arithmetic check for each equation. *** ## Program Structure The program is divided into three logical phases, looping indefinitely via `RUN` at line `280`: 1. **Initialisation (lines 10–30):** Sets display attributes (white ink on blue paper/border) and defines the random helper function. 2. **Problem generation (lines 40–120):** Picks random values and computes the equation constants. 3. **Presentation and solution (lines 130–270):** Displays the equations, waits for a keypress, then reveals the solution with verification. ## Variable and Function Usage | Name | Role | | --- | --- | | `FN M(N)` | Returns a random integer in the range 1–N inclusive | | `A`, `B`, `C`, `D` | Randomly chosen coefficients (1–10) | | `X`, `Y` | Randomly chosen solution values (1–10) | | `E`, `F` | Right-hand-side constants, computed as `A*X+B*Y` and `C*X+D*Y` | ## Notable Techniques - **Back-calculation for integer solutions:** Rather than generating equations and solving them, the program picks the answer first (`X`, `Y`) and derives the constants `E` and `F`. This guarantees the simultaneous equations always have whole-number solutions in the range displayed. - **User-defined function:**`DEF FN M(N)=INT (RND*N)+1` (line `40`) is defined once and reused six times, keeping the random-generation code concise. - **Attribute highlighting:**`INVERSE 1` is used in lines `140`–`160` to draw attention to the equation terms during the puzzle phase, and `FLASH 1` in lines `220`–`230` emphasises the revealed answers. - **Keypress wait idiom:**`PAUSE 0` at lines `180` and `270` halts execution until any key is pressed, a standard Spectrum technique. - **Verification output:** Lines `240`–`250` print the substituted arithmetic (e.g. `3*7 + 2*5 = 31`) as an explicit check, useful for educational purposes. - **Infinite loop via `RUN`:** Line `280` restarts the entire program rather than using `GO TO 50`, which also re-applies the display setup lines and re-evaluates the `DEF FN`. ## Source Code ``` 10 REM EQUATIONS 20 INK 7: PAPER 1 30 BORDER 1: CLS 40 DEF FN M(N)=INT (RND*N)+1 50 LET A=FN M(10) 60 LET B=FN M(10) 70 LET C=FN M(10) 80 LET D=FN M(10) 90 LET X=FN M(10) 100 LET Y=FN M(10) 110 LET E=A*X+B*Y 120 LET F=C*X+D*Y 130 PRINT ''' INK 6;"The equations are:" 140 PRINT 'TAB 8; INVERSE 1;A;"x + ";B;"y = ";E 150 PRINT 'TAB 8; INVERSE 1;C;"x + ";D;"y = ";F 160 PRINT '"You must solve them for "; INVERSE 1;"x"; INVERSE 0;" and "; INVERSE 1;"y" 170 PRINT ''"Press any key for the solution" 180 PAUSE 0 190 CLS 200 PRINT ''''TAB 8;A;"x + ";B;"y = ";E 210 PRINT 'TAB 8;C;"x + ";D;"y = ";F 220 PRINT 'TAB 4;"The value ot x is "; FLASH 1;x 230 PRINT 'TAB 4;"The value of y is "; FLASH 1;Y 240 PRINT 'TAB 8;A;"*";X;" + ";B;"*";Y;" = ";E 250 PRINT 'TAB 8;C;"*";X;" + ";D;"*";Y;" = ";F 260 PRINT '''"Press any key for a new problem" 270 PAUSE 0 280 RUN 9997 STOP 9998 SAVE "EQUATIONS" LINE 1 ```