-
Notifications
You must be signed in to change notification settings - Fork 139
Conway's Game of Life
isawdrones edited this page Apr 21, 2011
·
6 revisions
An implementation of Conway's Game of Life.
This uses the same approach as the APL version.
/ Run: disp brd amd: {.[x;(_((^x)-^y)%2)+!:'^y;:;y]} / Amend and center pnt: {|/y=\:x#!*/x} / Generate pentominoes fpt: pnt[3 3;1 2 3 4 7] / F-pentomino gld: pnt[3 3;1 5 6 7 8] / Glider brd: amd[5 7#0;fpt] / Board with fpt centered brd2: amd[20 20#0;fpt] / Larger board with fpt brd3: amd[20 20#0;gld] / Glider centered life: {a:3 4=\:+/+/-1 0 1!/:\:/:-1 0 1!\:x; (*a)|x&a@1} disp: {`0:'".#"[life\ x],'"\n";} / Display with chars until fixed point