programextensions/canvas/demos/life.xtl
Conway's Life in a native window: the board is an X_eTaL array, each generation one array expression, drawn by Rust with every frame. Run: just demo canvas life (Space: a new board; q or close: quit)
ᵘl̲ife : (Num a, Truthy a) => a -> a
Life (as in X_eTaL's demos/life.xtl): every cell plus its neighbors by rotating along both axes and summing; alive next at 3, or 4 if alive
ᵘl̲ife ← { ('+ r̲/₁₂ -1 0 1 o̲-₁₂ ⍵) { (⍺ = 3) + ⍵ × ⍺ = 4 } ⍵ }
Used in: ᵘf̲rame
ᵘs̲eed : Truthy a => Int -> a
a random board, about one cell in four alive
ᵘs̲eed ← { n → (n c̲at n) r̲eshape 1 = r̲oll! (n × n) r̲eshape 4 }
ᵘq̲uit : (Any a, Num b) => a -> b
after quitting: close the window; an empty board ends the loop's work
ᵘq̲uit ← { b → c ← ᶜᵛc̲lose! w 0 0 r̲eshape 0 }
Used in: ᵘf̲rame