--- title: "GraphicDemo" id: 56295 type: "computer_media" slug: "graphicdemo" url: "http://localhost/computer_media/graphicdemo/" markdown_url: "http://localhost/computer_media/graphicdemo.md" published_at: "2024-08-04T10:49:46+00:00" modified_at: "2026-03-30T21:42:53+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/08/SCR-20240803-jnze.png" excerpt: "A mesmerising shrinking geometric pattern built from just four DRAW commands, cycling through two ink colours as it spirals inward iteration by iteration." 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/" indiv: - name: "John Copps" slug: "john-copps" taxonomy: "indiv" url: "http://localhost/indiv/john-copps/" genre: - name: "Demo" slug: "demo" taxonomy: "genre" url: "http://localhost/type/demo/" media_contents: - id: 56277 title: "Timex Sinclair Public Domain Library Tape 2001" type: "computer_media" url: "http://localhost/computer_media/timex-sinclair-public-domain-library-tape-2001/" media_type: "Program" programmers: - name: "John Copps" slug: "john-copps" taxonomy: "indiv" url: "http://localhost/indiv/john-copps/" download_url: "https://archive.org/download/timex-sinclair-software-archive/GraphicDemo%20%28198x%29%28Copps%2C%20John%29%28TS2068%29%28US%29%28Program%29.zip" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/08/SCR-20240803-jnze.png" media_type_tags: "Demo" --- # GraphicDemo This program draws a continuously shrinking diamond-like geometric pattern using the PLOT and DRAW commands. Starting with parameters a=5 and b=75, it repeatedly draws four line segments that form a closed quadrilateral, then decrements both values by 1 each iteration. The INK colour alternates between red (INK 2) and green (INK 4) for successive pairs of lines, creating a two-tone effect. A PAUSE 15 slows each iteration slightly, and the loop runs indefinitely via GO TO 6 until interrupted. *** ## Program Analysis ### Program Structure The program is a straightforward infinite loop with no subroutines. After initialisation and a printer listing at lines 1–5, execution cycles through lines 6–90 repeatedly. The structure can be summarised as: 1. Lines 1–4: REMs and printer output (LLIST/LPRINT) 2. Line 5: Initialise variables `a=5`, `b=75` 3. Lines 6–8: Display current parameter values on screen 4. Lines 10–50: PLOT a starting point and DRAW a four-sided closed figure 5. Lines 60–70: Decrement both `a` and `b` by 1 6. Lines 80–90: Pause briefly and loop back to line 6 7. Line 100: COPY (dead code — never reached) ### Geometry of the Shape Each iteration draws a quadrilateral from a fixed start point (225, 90) using four DRAW segments: | Line | DRAW | INK | Direction | | --- | --- | --- | --- | | 20 | DRAW a, b | 2 (red) | up-right | | 30 | DRAW a, -b | 2 (red) | down-right | | 40 | DRAW -a, -b | 4 (green) | down-left | | 50 | DRAW -a, b | 4 (green) | up-left | Because the horizontal extent is `a` and the vertical extent is `b`, and since `b` starts at 75 (much larger than `a=5`), the shape is a very tall, narrow diamond. Each loop iteration shrinks both dimensions by 1, causing the figure to collapse toward a vertical line as `a` approaches zero after 5 iterations, while `b` still has 70 iterations remaining before it too reaches zero. ### Notable Techniques - **Colour split within a shape:** INK is changed between lines 30 and 35, so the right two edges are drawn in red and the left two in green, bisecting the diamond by colour. - **AT-positioned parameter display:** Lines 7–8 use `PRINT AT` to show the current values of `a` and `b` at fixed screen positions, updating them each pass without clearing the whole screen. - **PAUSE 15:** Introduces a brief delay (approximately one third of a second at 50 Hz) to make the animation visible rather than a blur. - **Dead code at line 100:** The `COPY` command is never reached because the `GO TO 6` loop has no exit condition. ### Potential Anomalies - Once `a` drops below zero (after iteration 6), the DRAW calls use negative `a` values, mirroring the shape horizontally. The loop never terminates, so `b` will eventually go negative too, producing increasingly unusual figures. - The PLOT at line 10 executes only once (before the first iteration of the loop), so subsequent iterations continue drawing from wherever the pen was left, not from (225, 90). This means the shapes are chained rather than redrawn from a fixed origin each time. - Lines 4 (LLIST/LPRINT) execute unconditionally on every run, which will send the program listing to the printer before the graphical loop begins. ## Source Code ``` 1 REM "GRAPHIC ?" 2 REM By John Copps 4 LLIST : LPRINT 5 LET a=5: LET b=75 6 INK 2 7 PRINT AT 2,6;"a=";a 8 PRINT AT 2,20;"b=";b 10 PLOT 225,90 20 DRAW a,b 30 DRAW a,-b 35 INK 4 40 DRAW -a,-b 50 DRAW -a,b 60 LET a=a-1 70 LET b=b-1 80 INK 4: PAUSE 15 90 GO TO 6 100 COPY ```