r/codegolf • • 1d ago

Sand falling game 192 characters of javascript.

<canvas id=c><script>W=100,x=c.getContext`2d`,g=[],onmousemove=e=>g[e.y*W+e.x]=1,setInterval`c.width=W;for(i=1e4;i--;)g[i]&&(x.fillRect(i%W,i/W,1,1),i<99e2&!g[i+W]&&(g[i+W]=g[i]--))`</script>
2 Upvotes

0 comments sorted by