' I think this program implements Brownian Motion. ' Or something like it, anyway. ' Allan Crossman, 2001 ' OPTIONS YOU CAN FIDDLE WITH: colonies = 5 ' More is slower. store = 1000 ' More means bigger colonies. jumpsize = 0.5 ' More than 0.5 leaves gaps in coverage. width = screen width depth = screen height - 20 y_offset = 20 ' This just moves the whole window down this much ' I use it to accomodate the menu bar. overdrawprob = 0.6 teleportprob = 0 dim red(colonies) dim green(colonies) dim blue(colonies) ' Draw colours for the various colonies... ' You should set these for every colony (else they'll be jet black) red(1) = 65535 red(2) = 65535 red(3) = 65535 red(4) = 65535 green(4) = 20000 red(5) = 65535 green(5) = 20000 ' ' ' ' ' ' ' ' ' ' ' ' ' ' randomize timer dim storedx(colonies, store) dim storedy(colonies, store) x1 = (screen width / 2) - (width / 2) y1 = ((screen height / 2) + (y_offset / 2)) - (depth / 2) x2 = (screen width / 2) + (width / 2) y2 = ((screen height / 2) + (y_offset / 2)) + (depth / 2) resize console x1, y1, x2, y2 cls dim x(colonies) dim y(colonies) for i = 1 to colonies x(i) = int(width / 2) y(i) = int(depth / 2) storedx(i, 1) = x(i) storedy(i, 1) = y(i) next i n = 1 main: if inkey$ = "q" or inkey$ = "Q" or inkey$ = chr$(27) then disable done end end if for i = 1 to colonies if fadeoldflag and rnd < overdrawprob and (buttonflag < store) then forecolor 0, 0, 0 plot storedx(i, n), storedy(i, n) end if if rnd < teleportprob then x(i) = int(rnd * width) y(i) = int(rnd * depth) else if rnd < 0.5 then x(i) = x(i) + jumpsize else x(i) = x(i) - jumpsize if x(i) < 0 then x(i) = width - 1 if x(i) > width - 1 then x(i) = 0 if rnd < 0.5 then y(i) = y(i) + jumpsize else y(i) = y(i) - jumpsize if y(i) < 0 then y(i) = depth - 1 if y(i) > depth - 1 then y(i) = 0 end if storedx(i, n) = x(i) storedy(i, n) = y(i) if button = 0 then forecolor red(i), green(i), blue(i) plot x(i), y(i) end if next i n = n + 1 if n > store then n = 1 fadeoldflag = 1 end if if button then if buttonflag < store then buttonflag = buttonflag + 1 else buttonflag = 0 end if pauseloop: if inkey$ <> "p" and inkey$ <> "P" then goto main else goto pauseloop