3 ms·
Obligatory http://www.youtube.com/watch?v=a9xAKttWgP4 http://www.youtube.com/watch?v=a9xAKttWgP4 APL version explained. Here's one I found online http://dfns.d
by willvarfar 13y ago
Obligatory http://www.youtube.com/watch?v=a9xAKttWgP4 http://www.youtube.com/watch?v=a9xAKttWgP4 APL version explained.
Here's one I found online http://dfns.dyalog.com/s_life.htm http://dfns.dyalog.com/s_life.htm
life←{ ⍝ John Conway's "Game of Life".
↑1 ⍵∨.^3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵ ⍝ Expression for next generation.
}
Completely awesome convolution method.
- kaoD 13y agoCertainly awesome. Note that this implementation is toroidal. My take on J[1] (code-golfed) based in the same algorithm: l=:[:+/(3 4=/[:+/(,/,"0/~i:1)|.])*.1,:] De-golfed: life =: [: +/ (3 4 =/ [: +/ (,/ ,"0/~ i:1) |. ]) *. 1 ,: ] [1] http://www.jsoftware.com http://www.jsoftware.com