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

@@ -163,24 +163,24 @@ function walk_around_from(x, y, dirs, cells, rows, columns, x_wrapping, y_wrappi
// 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) =
// is the dir visitable?
!visitable(next_x(x, dir, columns, x_wrapping), next_y(y, dir, rows, y_wrapping), cells, rows, columns) ?
// road closed so return cells directly
cells :
// try the cell
go_maze(
next_x(x, dir, columns, x_wrapping), next_y(y, dir, rows, y_wrapping),
carve(dir, x, y, cells, rows, columns), carve(dir, x, y, cells, rows, columns),
rows, columns, rows, columns,
x_wrapping, y_wrapping, x_wrapping, y_wrapping,
seed seed
); )
)
walk_around_from(x, y, dirs,
// try one direction
nx_cells,
rows, columns,
x_wrapping, y_wrapping,
i - 1,
seed);