diff options
Diffstat (limited to 'js/baba-yaga/scratch/baba/test_grid_display.baba')
-rw-r--r-- | js/baba-yaga/scratch/baba/test_grid_display.baba | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/js/baba-yaga/scratch/baba/test_grid_display.baba b/js/baba-yaga/scratch/baba/test_grid_display.baba new file mode 100644 index 0000000..037230e --- /dev/null +++ b/js/baba-yaga/scratch/baba/test_grid_display.baba @@ -0,0 +1,20 @@ +// Test grid display +showCell : cell -> + when cell is + 1 then "█" + _ then "·"; + +showRow : row -> + reduce (acc cell -> str.concat acc (showCell cell)) "" row; + +showGrid : grid -> + reduce (acc row -> str.concat acc (str.concat (showRow row) "\n")) "" grid; + +testGrid : [ + [1, 0, 1], + [0, 1, 0], + [1, 0, 1] +]; + +io.out "Test Grid:"; +io.out showGrid testGrid; |