Differences between revisions 10 and 22 (spanning 12 versions)
Revision 10 as of 2007-02-24 21:36:59
Size: 504
Editor: KaiJaeger
Comment:
Revision 22 as of 2008-08-20 18:57:21
Size: 674
Editor: anonymous
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= John Conways`s "Game of Life" = ## page was renamed from FunExamples
= John Conwayss Game of Life =
Line 3: Line 4:
This dynamic function takes a boolean matrix as argument and return a boolean matrix with the new generation. It is taken from [http://www.dyalog.dk/dfnsdws/n_life.htm Dyalog`s] Website which at the time being (2007-02-09) does not support Unicode. However, you will see APL characters with Internet Explorer but not with any other browser. This function takes a boolean matrix as argument and returns a boolean matrix with the new generation.
Line 6: Line 7:
life←{↑1 ⍵∨.∧3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵}   ∇ nextGeneration←Life currentGeneration
[1] ⍝⍝ Take a matrix of Booleans and returns one
[2] nextGeneration←↑1 currentGeneration∨.∧3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂currentGeneration
  ∇
Line 9: Line 13:

== External links ==

 * WikiPedia:Conways_Game_of_Life
 * [[http://catpad.net/michael/apl/|Conway’s Game of Life in one line of APL]]
 * [[http://www.vector.org.uk/archive/v213/cliff213.htm|Time(r) for the Game of Life]]
Line 10: Line 21:

CategoryShowcases, CategoryDyalog
CategoryShowcases

John Conways’s “Game of Life”

This function takes a boolean matrix as argument and returns a boolean matrix with the new generation.

  ∇ nextGeneration←Life currentGeneration
[1] ⍝⍝ Take a matrix of Booleans and returns one
[2]  nextGeneration←↑1 currentGeneration∨.∧3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂currentGeneration


CategoryShowcases

GameOfLife (last edited 2015-01-28 19:11:48 by KaiJaeger)