Skip to content

Instantly share code, notes, and snippets.

@tylerholien
tylerholien / gist:8062043
Last active December 31, 2015 23:49
A function that computes one step of Conway's Game of Life on an infinite board in 131 characters.
->z{h=Hash.new 0;z.map{|x,y|([x-1,x,x+1].product([y-1,y,y+1])-[[x,y]]).map{|p|h[p]+=1}};h.select{|a,b|b==3||b==2&&z.index(a)}.keys}
pairToList :: (a,a) -> [a]
pairToList = (flip map) [fst,snd] . flip ($)

Keybase proof

I hereby claim:

  • I am tylerholien on github.
  • I am tylerholien (https://keybase.io/tylerholien) on keybase.
  • I have a public key ASBDDLlIR9zNrhdkMJYDKv1ZoYcgrMGi3-hK7193M9RWLwo

To claim this, I am signing this object: