Ricochet

Date: 1991
Type: Program
Platform(s): ZX81, TS 1000
Tags: Graphics

A pattern program that fits in 1K: a point starts at a random place and speed and bounces around inside a box, leaving a trail that builds into a woven pattern.

RUN it and watch. It runs until you press BREAK.

Published in LISTing October 1991 (Ricochet).

Related Articles

“Ricochet” is a pattern program by James J. Hollandsworth

Image Gallery

Source Code

   3 LET N=CODE "H"
   4 LET A=CODE "E"
   5 LET G=NOT PI
   6 LET E=RND*VAL "4"-VAL "2"
   7 LET M=RND*VAL "4"-VAL "2"
   8 LET X=RND*N
   9 LET Y=RND*A
  10 PLOT X,Y
  13 LET X=X+E
  14 LET Y=Y+M
  15 IF X<G THEN LET X=G
  16 IF Y<G THEN LET Y=G
  17 IF X>N THEN LET X=N
  18 IF Y>A THEN LET Y=A
  19 IF X=G OR X=N THEN LET E=-E
  20 IF Y=G OR Y=A THEN LET M=-M
  21 GOTO PI*PI

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