1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-17 20:11:50 +02:00
This commit is contained in:
Justin Lin
2022-03-18 13:08:33 +08:00
parent 120b7ea2c7
commit 2cd56758eb

View File

@@ -162,25 +162,25 @@ function go_maze(x, y, cells, rows, columns, x_wrapping = false, y_wrapping = fa
function walk_around_from(x, y, dirs, cells, rows, columns, x_wrapping, y_wrapping, i, seed) = function walk_around_from(x, y, dirs, cells, rows, columns, x_wrapping, y_wrapping, i, seed) =
// all done? // all done?
i == -1 ? cells : i == -1 ? cells :
// not yet // not yet
walk_around_from(x, y, dirs, let(
// try one direction dir = dirs[i],
try_routes_from(x, y, dirs[i], cells, rows, columns, x_wrapping, y_wrapping, seed), nx = next_x(x, dir, columns, x_wrapping),
rows, columns, ny = next_y(y, dir, rows, y_wrapping),
x_wrapping, y_wrapping, nx_cells = !visitable(nx, ny, cells, rows, columns) ? // is the dir visitable?
i - 1, cells : // road closed so return cells directly
seed); go_maze( // try the cell
nx, ny,
function try_routes_from(x, y, dir, cells, rows, columns, x_wrapping, y_wrapping, seed) = carve(dir, x, y, cells, rows, columns),
// is the dir visitable? rows, columns,
!visitable(next_x(x, dir, columns, x_wrapping), next_y(y, dir, rows, y_wrapping), cells, rows, columns) ? x_wrapping, y_wrapping,
// road closed so return cells directly seed
cells : )
// try the cell )
go_maze( walk_around_from(x, y, dirs,
next_x(x, dir, columns, x_wrapping), next_y(y, dir, rows, y_wrapping), // try one direction
carve(dir, x, y, cells, rows, columns), nx_cells,
rows, columns, rows, columns,
x_wrapping, y_wrapping, x_wrapping, y_wrapping,
seed i - 1,
); seed);