Graph Time

Date: 198x
Type: Program
Platform(s): TS 2068
Tags: Demo, Graphics

This program generates a graphic pattern on screen by drawing a series of lines from points along a horizontal axis, creating a symmetric geometric figure. The user inputs a numeric step value, which controls the spacing of iterations in a FOR loop running from 0 to 85. Four DRAW commands per iteration radiate lines from two anchor points (x=214, x=44) through a central horizontal baseline at y=88, forming diamond- or fan-like shapes that vary dramatically depending on the step value entered. Entering “c” clears the screen and prompts for a new value, allowing the user to experiment with different patterns. After each pattern completes, a PAUSE of 120 frames holds the display before automatically clearing and looping back.


Program Analysis

Program Structure

The program is organized as a simple interactive loop. Lines 10–90 are REM comments crediting the author and publisher. Line 100 prompts for user input as a string, line 110 handles the special case of entering "c" to clear the screen, and lines 120–220 perform the drawing loop. Line 225 pauses briefly and clears, then line 230 returns to the input prompt.

  1. User enters a step value (or "c" to clear)
  2. The FOR loop runs i from 0 to 85 in steps of n
  3. Four PLOT/DRAW pairs draw symmetric lines per iteration
  4. After the loop, the screen pauses for 2 seconds then clears

Drawing Geometry

Each iteration of the loop draws four line segments anchored at two x-positions: approximately x=213−i (varying) and x=44 (fixed, with a minor bug — see below). The lines extend vertically by amounts proportional to i, creating a pattern that fans outward as the loop progresses. The baseline is y=88, which is roughly the vertical center of the 176-pixel-tall display.

LineStart PointDraw VectorDirection
140–150PLOT 213−i, 88DRAW i−85, 1Up-left
160–170PLOT 44, 88DRAW 85−i, iRight and up
180–190PLOT 213−i, 88DRAW i−85, −iDown-left
200–210PLOT 44, 88DRAW 85−i, −iRight and down

Key BASIC Idioms

  • String input for dual purpose: n$ is read as a string first, allowing the single input to serve as either a command ("c") or a numeric value converted with VAL n$.
  • AT 0,0 status line: Line 120 uses PRINT AT 0,0 to display the current step value without disturbing the drawing area.
  • PAUSE then GO TO loop: The PAUSE 120 at line 225 holds the completed pattern visible for approximately 2 seconds before CLS and returning to the input prompt.

Notable Techniques

The choice of 85 as the loop limit and the x-offsets 213 and 43/44 are not arbitrary: 85 is one quarter of 340, the notional pixel width scaled for the display, and the two anchor points are roughly symmetric about the horizontal center (x=128). The varying step value n dramatically changes the visual output — a step of 1 produces dense concentric shapes while a step of 17 produces only five widely spaced lines.

Bugs and Anomalies

There is a minor inconsistency in lines 160 and 200: the PLOT command uses 43+1 (i.e., 44) as a literal arithmetic expression rather than simply 44. This is functionally identical but suggests a possible editing artifact where the original expression may have included a variable or offset that was later simplified incompletely.

Additionally, the DRAW on line 150 adds only 1 to the y-coordinate (DRAW i−85, 1), which is asymmetric with the other three draws. The upper-left set of lines is nearly horizontal while the lower-left and both right-side sets fan out proportionally with i. This asymmetry may be intentional for artistic effect or could be a typographic error for i.

Content

Appears On

Related Products

Related Articles

Related Content

Image Gallery

Graph Time

Source Code

   10 REM ** A GRAPHIC PASTIME
   20 REM ** A TS2068 PGM BY
   30 REM ** STEVEN SCOVILLE
   50 REM ** ORIGINALLY PUBLISHED
   60 REM ** BY THE TRIANGLE SINCLAIR
   70 REM ** USERS GROUP, NORTH
   80 REM ** CAROLINA
   90 REM **
  100 INPUT n$
  110 IF n$="c" THEN CLS : GO TO 100
  120 LET n=VAL n$: PRINT AT 0,0;"INPUT ",n," PRODUCES:  "
  130 FOR i=0 TO 85 STEP n
  140 PLOT 213-i,88
  150 DRAW i-85,1
  160 PLOT 43+1,88
  170 DRAW 85-i,i
  180 PLOT 213-i,88
  190 DRAW i-85,-i
  200 PLOT 43+1,88
  210 DRAW 85-i,-i
  220 NEXT i
  225 PAUSE 120: CLS 
  230 GO TO 100

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top