about summary refs log tree commit diff stats
path: root/js/baba-yaga/scratch/baba/test_grid_display.baba
blob: 037230e65e0309f7cd2688a2b2471ca7f9bb4703 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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;