diff --git a/src/maze/_impl/_mz_square_cells_impl.scad b/src/maze/_impl/_mz_square_cells_impl.scad index f5b0a495..dd1b626f 100644 --- a/src/maze/_impl/_mz_square_cells_impl.scad +++ b/src/maze/_impl/_mz_square_cells_impl.scad @@ -1,6 +1,6 @@ use <_mz_square_comm.scad>; -function eqPos(x, y, cell) = get_x(cell) == x && get_y(cell) == y; +function eqPos(x, y, cell) = cell.x == x && cell.y == y; // is (x, y) visited? function visited(x, y, cells, columns) = cells[y * columns + x][3]; diff --git a/src/maze/_impl/_mz_square_comm.scad b/src/maze/_impl/_mz_square_comm.scad index bd15b24a..10d14ec2 100644 --- a/src/maze/_impl/_mz_square_comm.scad +++ b/src/maze/_impl/_mz_square_comm.scad @@ -10,6 +10,6 @@ function right_wall(cell) = get_type(cell) == 2; function top_right_wall(cell) = get_type(cell) == 3; function cell(x, y, type, visited) = [x, y, type, visited]; -function get_x(cell) = cell[0]; -function get_y(cell) = cell[1]; +function get_x(cell) = cell.x; +function get_y(cell) = cell.y; function get_type(cell) = cell[2]; \ No newline at end of file diff --git a/src/maze/_impl/_mz_square_walls_impl.scad b/src/maze/_impl/_mz_square_walls_impl.scad index 7095f02d..ed1f6c6e 100644 --- a/src/maze/_impl/_mz_square_walls_impl.scad +++ b/src/maze/_impl/_mz_square_walls_impl.scad @@ -1,7 +1,7 @@ use <_mz_square_comm.scad>; function _square_walls(cell, cell_width) = - let(loc = [get_x(cell), get_y(cell)] * cell_width) + let(loc = [cell.x, cell.y] * cell_width) [ if(top_wall(cell) || top_right_wall(cell)) each [[0, cell_width] + loc, [cell_width, cell_width] + loc], if(right_wall(cell) || top_right_wall(cell)) each [[cell_width, cell_width] + loc, [cell_width, 0] + loc] diff --git a/src/maze/mz_hamiltonian.scad b/src/maze/mz_hamiltonian.scad index fb48bfcf..eb4f0ec8 100644 --- a/src/maze/mz_hamiltonian.scad +++ b/src/maze/mz_hamiltonian.scad @@ -24,8 +24,8 @@ function mz_hamiltonian(rows, columns, start = [0, 0], seed) = [ for(cell = cells) let( - x = mz_square_get(cell, "x"), - y = mz_square_get(cell, "y"), + x = cell.x, + y = cell.y, type = mz_square_get(cell, "t") ) each if(type == "TOP_WALL") _mz_hamiltonian_top(x, y) else diff --git a/src/maze/mz_wang_tiles.scad b/src/maze/mz_wang_tiles.scad index 31615360..f163cc06 100644 --- a/src/maze/mz_wang_tiles.scad +++ b/src/maze/mz_wang_tiles.scad @@ -25,8 +25,8 @@ function mz_wang_tiles(rows, columns, start = [0, 0], init_cells, seed) = [ for(cell = cells) let( - x = mz_square_get(cell, "x"), - y = mz_square_get(cell, "y"), + x = cell.x, + y = cell.y, type = mz_square_get(cell, "t"), pts = type == "TOP_WALL" ? _mz_wang_tiles_top(x, y) : type == "RIGHT_WALL" ? _mz_wang_tiles_right(x, y) :