about summary refs log tree commit diff stats
path: root/js/baba-yaga/scratch/baba/conway-test.baba
blob: ef8be9967277897d60ede8829e2c3004eec542ed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Simple Game of Life test

// Safe array access
at : xs i ->
  when (i >= 0 and i < length xs) is
    true then slice xs i (i + 1).0
    _ then 0;

// Test pattern
pattern : [[0, 1, 0], [0, 0, 1], [1, 1, 1]];

io.out "Testing:";
io.out pattern;
io.out "Cell at (1,1):";
io.out (at (at pattern 1) 1);
io.out "Done!";