Skip to content

Instantly share code, notes, and snippets.

@skymonsters-Ks
Created January 25, 2020 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skymonsters-Ks/0d44a45f8f2af4f8a687d55d688d13ae to your computer and use it in GitHub Desktop.
Save skymonsters-Ks/0d44a45f8f2af4f8a687d55d688d13ae to your computer and use it in GitHub Desktop.
#const SCALE 1
screen 0, 1600, 900
ox = double(ginfo_sx / 4), ox * 3
oy = double(ginfo_sy / 2), oy
x = ox, ox.1
y = oy, oy
randomize
a = hwnd, a
cf = 1
line ox * 2, oy * 2, ox * 2
repeat : c = cnt
if c \ 1000 == 0 : title strf("%d", c) : redraw 1 : redraw 0
; if c \ (1<<18) == 0 : cf ^= 1 : rgbcolor cf * $ffffff
repeat 2 : m = cnt
switch rand(4)
case 0 : x.m-SCALE : if x.m < ox.m - ox : x.m += ox * 2
swbreak
case 1 : y.m-SCALE : if y.m < oy.m - oy : y.m += oy * 2
swbreak
case 2 : x.m+SCALE : if x.m > ox.m + ox : x.m -= ox * 2
swbreak
case 3 : y.m+SCALE : if y.m > oy.m + oy : y.m -= oy * 2
swend
pset x.m, y.m
loop
wait 0
loop
#defcfunc rand int _p
if m {
; LFSR
a.1 ^= a.1 >> 9 ^ a.1 << 1
return (a.1 & $7fffffff) \ _p
} else {
; LCG
return rnd(_p)
; a.0 = (a.0 * 214013 + 2531011) & $7fffffff
; return (a.0 >> 16) \ _p
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment