From ce257f859b29ea2afc4edd2770592ae1a0138833 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Sat, 27 Aug 2022 17:31:36 +0800 Subject: [PATCH] add directions param --- src/maze/mz_square.scad | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/maze/mz_square.scad b/src/maze/mz_square.scad index 62066d24..9d9654c8 100644 --- a/src/maze/mz_square.scad +++ b/src/maze/mz_square.scad @@ -11,11 +11,10 @@ use <_impl/_mz_square_cells_impl.scad> use -function mz_square(rows, columns, start = [0, 0], init_cells, x_wrapping = false, y_wrapping = false, seed) = +function mz_square(rows, columns, start = [0, 0], init_cells, x_wrapping = false, y_wrapping = false, seed, directions) = let( init_undef = is_undef(init_cells), - mz = init_undef ? mz_square_initialize(rows, columns) : init_cells, - directions = function(x, y, cells, seed) rand_dirs(x, y, cells, seed) + mz = init_undef ? mz_square_initialize(rows, columns) : init_cells ) go_maze( start.x, @@ -26,5 +25,5 @@ function mz_square(rows, columns, start = [0, 0], init_cells, x_wrapping = false x_wrapping, y_wrapping, seed, - directions + is_undef(directions) ? function(x, y, cells, seed) rand_dirs(x, y, cells, seed) : directions );