Another trip down Memory Lane: SQUARES



I believe John Bohner was the originator of this little toy
program, back in... well, don't remember the year, but I
first saw it running at 1200 baud. It actually is more fun
to watch at slower speeds. Written for uniData BASIC, but
pretty generic code that should compile on other platforms.

--
frosty

w = INT((SYSTEM(2)+2)/24)
h = INT((SYSTEM(3)+1)/12)
spots = "*+X#\/-| "
LOOP UNTIL SYSTEM(14) DO
x = 14 + 24 * (RND(w)); y = 5 + 12 * (RND(h))
zone1 = RND(5); zone2 = RND(6)
IF zone1 = zone2 THEN zone1 = 0; zone2 = 5
IF zone1 < zone2 THEN dir = 1 ELSE dir = -1
spot = spots[RND(LEN(spots))+1,1]; spot2 = spot:spot
FOR zone = zone1 TO zone2 STEP dir
t = y-zone; b = y+zone; l = x-zone*2; r = x+zone*2
IF zone1 = 0 AND zone2 = 5 THEN
CRT @(x-zone*2,y-zone):spot2: @(x+zone*2,y-zone):spot2:
CRT @(x-zone*2,y+zone):spot2: @(x+zone*2,y+zone):spot2:
END ELSE
CRT @(l,t):STR(spot,zone*4): @(l,b):STR(spot,zone*4):
FOR i = t TO b STEP 1; CRT @(l,i):spot2:; NEXT i
FOR i = b TO t STEP -1; CRT @(r,i):spot2:; NEXT i
END
NEXT zone
REPEAT
END


.