Conway's Game of Life: Difference between revisions

Jump to navigation Jump to search
(More context in introduction)
Line 53: Line 53:
=== Visualising it ===
=== Visualising it ===


To make the pattern easier to see, we can print a <source lang=apl inline>⌺</source> symbol where there's a cell and a <source lang=apl inline>·</source> otherwise, for example:
To make the pattern easier to see, we can use [[indexing]] to place a <source lang=apl inline>⌺</source> symbol where there's a cell and a <source lang=apl inline>·</source> otherwise, for example:
<source lang=apl>
<source lang=apl>
       Show←{'·⌺'[⎕IO+⍵]}
       Show←{'·⌺'[⎕IO+⍵]}
Line 69: Line 69:
</source>
</source>


Here's how the Glider evolves over the first ten generations:
Here's how the Glider evolves over the first ten generations, computed using the [[Power operator]] for iteration:
<source lang=apl>
<source lang=apl>
       Show¨{Life⍣⍵⊢grid}¨0,⍳9
       Show¨{Life⍣⍵⊢grid}¨0,⍳9

Navigation menu