about summary refs log tree commit diff stats
path: root/js/baba-yaga/scratch/baba/conway-test.baba
diff options
context:
space:
mode:
Diffstat (limited to 'js/baba-yaga/scratch/baba/conway-test.baba')
-rw-r--r--js/baba-yaga/scratch/baba/conway-test.baba16
1 files changed, 16 insertions, 0 deletions
diff --git a/js/baba-yaga/scratch/baba/conway-test.baba b/js/baba-yaga/scratch/baba/conway-test.baba
new file mode 100644
index 0000000..ef8be99
--- /dev/null
+++ b/js/baba-yaga/scratch/baba/conway-test.baba
@@ -0,0 +1,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!";