(Warning: If you are sensitive to flashing lights, I recommend you don't run this)

This is Conway's Game of life (https://en.wikipedia.org/wiki/Conway's_Game_of_Life) in under 400 characters (and here is the proof):

g={}for y=0,128 do g[y]={} for x=0,128 do if((flr(rnd(2))+1)==1)g[y][x]=true else g[y][x]=false end end

::★:: cls() ng={} for y=0,128 do ng[y]={} for x=0,128 do nc=0 for dy=-1,1 do for dx=-1,1 do if not (dy==0and dx==0)and g[y+dy]and g[y+dy][x+dx] then nc+=1  end end end
ng[y][x]=nc==3or(g[y][x]and nc==2) if(g[y][x])pset(x,y,7) end end
g=ng flip() goto ★


1klife.p8.png 3 kB

Leave a comment

Log in with itch.io to leave a comment.