From ca53871f79a28ef5403496e64be3a1b0ab3bedaa Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Wed, 11 Nov 2020 08:31:45 +0800 Subject: [PATCH] format --- src/maze/_impl/_mz_blocks_impl.scad | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/maze/_impl/_mz_blocks_impl.scad b/src/maze/_impl/_mz_blocks_impl.scad index 3de204ba..16b7c32a 100644 --- a/src/maze/_impl/_mz_blocks_impl.scad +++ b/src/maze/_impl/_mz_blocks_impl.scad @@ -92,20 +92,14 @@ function next_y(y, dir, rows, circular) = // go right and carve the right wall function visit_right(x, y, maze) = [ for(b = maze) [get_x(b), get_y(b)] == [x, y] ? ( - top_right_wall(b) ? - [x, y, 1, 1] : - [x, y, 0, 1] - + top_right_wall(b) ? [x, y, 1, 1] : [x, y, 0, 1] ) : b ]; // go up and carve the top wall function visit_top(x, y, maze) = [ for(b = maze) [get_x(b), get_y(b)] == [x, y] ? ( - top_right_wall(b) ? - [x, y, 2, 1] : - [x, y, 0, 1] - + top_right_wall(b) ? [x, y, 2, 1] : [x, y, 0, 1] ) : b ]; @@ -115,18 +109,15 @@ function visit_left(x, y, maze, columns) = x_minus_one = x - 1, nx = x_minus_one < 1 ? x_minus_one + columns : x_minus_one ) - [ - for(b = maze) [get_x(b), get_y(b)] == [nx, y] ? [nx, y, 1, 0] : b - ]; + [for(b = maze) [get_x(b), get_y(b)] == [nx, y] ? [nx, y, 1, 0] : b]; // go down and carve the top wall of the bottom block -function visit_bottom(x, y, maze, rows) = [ +function visit_bottom(x, y, maze, rows) = let( y_minus_one = y - 1, ny = y_minus_one < 1 ? y_minus_one + rows : y_minus_one ) - for(b = maze) [get_x(b), get_y(b)] == [x, ny] ? [x, ny, 2, 0] : b -]; + [for(b = maze) [get_x(b), get_y(b)] == [x, ny] ? [x, ny, 2, 0] : b]; // 0(right), 1(top), 2(left), 3(bottom) function try_block(dir, x, y, maze, rows, columns) =