Skip to content

Instantly share code, notes, and snippets.

@pbsds
Created September 19, 2022 11:59
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 pbsds/e7e560fc3db69cf20a4f3a6120c3a871 to your computer and use it in GitHub Desktop.
Save pbsds/e7e560fc3db69cf20a4f3a6120c3a871 to your computer and use it in GitHub Desktop.
smol
import numpy as n,pygame as p
q=(999,)*2
b=n.random.rand(*q)>.3
t=p.display
r=n.roll
o=p.surfarray.pixels2d(t.set_mode(q))
while 1:
w=sum(r(r(b,a,0),c,1)for a in[-1,0,1]for c in[-1,0,1])
b=b&((w==3)|(w==4))|((~b)*(w==3))
o[:,:]=0-b
t.flip()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment