X0% = 160
Y0% = 100
X1% = 160
Y1% = 100
HGR
KEY% = 0
COUNTER% = 0
COLOR0% = 1
COLOR1% = 2
DO UNTIL (KEY% = 83 OR KEY% = 115)
WHILE (COUNTER% < 1000 AND KEY% <> 83 AND KEY% <> 115)
DX% = SGN ( RND (1) - 0.5) * 1
DY% = SGN ( RND (1) - 0.5) * 1
X1% = X0% + DX%
Y1% = Y0% + DY%
IF X1% > 320 THEN X1% = 320
IF X1% < 0 THEN X1% = 0
IF Y1% > 200 THEN Y1% = 200
IF Y1% < 0 THEN Y1% = 0
HCOLOR= COLOR0%
HPLOT X0%, Y0%
HCOLOR= COLOR1%
HPLOT X1%, Y1%
X0% = X1%
Y0% = Y1%
COUNTER% = COUNTER% + 1
KEY% = PEEK ($00C000)
WEND
COUNTER% = 0
COLOR0% = COLOR0% + 1
IF COLOR0% = 16 THEN COLOR0% = 1
COLOR1% = COLOR1% + 1
IF COLOR1% = 16 THEN COLOR1% = 1
LOOP