[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Two-liner; Stars
This two-liner started as a program that repeatedly plotted 1000 randomly
placed dots on the HiRes-2 screen, then erased them. To make it a little
more interesting I use an random number raised to a power to biase the
number towards zero. This allows you to crowd the results around a single
point on the screen instead of being evenly distributed. To make a long
story short (please do) placing the origin in the center of the screen
results in a cruciform star shape. Kinda neat.
0 REM 'STARS' A TWO-LINER BY JOHN L. GRAHAM. CONTROL-C TO STOP
1 DIM A(1000),B(1000):C = 138 / 0.5 ^ 3:D = 94 / 0.5 ^ 3: HGR2
2 HCOLOR= 3: FOR E = 0 TO 1000:A(E) = 140 + ( RND (1) - 0.5) ^ 3 * C:
B(E) = 95 + ( RND (1) - 0.5) ^ 3 * D: HPLOT A(E),B(E): NEXT :
HCOLOR= 0: FOR E = 0 TO 1000: HPLOT A(E),B(E): NEXT : GOTO 2
Have fun!
John