Amazing programs so far...
Here's my attempt... 255 bytes in size. :)
You can change the size of the graphics window with the variable g. Any optimisations are welcome! :)
Here's the "clean", commented code:
Here's my attempt... 255 bytes in size. :)
g=300;Graphics g,g,0;Local a[g*g];Repeat;a[Rand(g)]=1;For x=g To g*g If(x+2)Mod g=0 Then x:+3 f=Rand(-3,2);If a[x]~a[x-g+f] a[x-g+f]=0;a[x]=1;c=255;SetColor c,c,c;Plot x Mod g,x/g;SetColor 0,0,0;Plot x Mod g+f,x/g-1;End If;Next;Flip 0;Until KeyDown(27)
You can change the size of the graphics window with the variable g. Any optimisations are welcome! :)
Here's the "clean", commented code:
g=300 Graphics g,g,0 'square graphics window Local a[g*g] 'initialise an array to hold the "snowflakes" Repeat a[Rand(g)]=1 'spawn a snow flake For x=g To g*g 'update all snow flakes If(x+2)Mod g=0 Then x:+3 'skip some pixels if we're close to the edge to avoid "stuck" flakes f=Rand(-3,2) 'move flakes to the left or right randomly If a[x]~a[x-g+f] 'if the pixel the flake tries to move to is unoccupied a[x-g+f]=0 'move flake by swapping values a[x]=1 c=255 SetColor c,c,c 'set color to white Plot x Mod g,x/g 'draw flake SetColor 0,0,0 Plot x Mod g+f,x/g-1 'remove trail End If Next Flip 0 'woo :) Until KeyDown(27) 'repeat until escape is pressed