Galton Board simulator tweet cart

Remix it on pico-8-edu.com

This cart is tweetable at just 277 characters.

p={}i=0k=128f=fillp::_::if(i==k)flip()cls()i=0
f(░)line(i,9,i,70,5)f()line(i,k,i,k-@i,15)
p[i]=p[i]or{x=-k,y=0,v=0,w=0,r=rnd,o=_ENV}
_ENV=p[i]pset(x,y,15)g=r(8)w+=.1x+=v
y+=w
if(y>128)poke(x,@x+1)x,y,v,w=60+g,g/5,0,0
if(y>9and y<70and g<2)v=cos(g)/2w=sin(g)/2
_ENV=o
i+=1goto _

About

See the explainer on GitHub

Comments

Log in with itch.io to leave a comment.

That is so cool! I’d love a line by line explanation for how it works, or at least an un-minified version of the source

Thanks! I added a link in the About section that is an unminified, commented version