From 6292c8989acfcb82016e25d9cef9ce113f9a8456 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Thu, 24 Mar 2022 22:30:12 +0800 Subject: [PATCH] refactor: conditional value --- src/maze/mz_wang_tiles.scad | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/maze/mz_wang_tiles.scad b/src/maze/mz_wang_tiles.scad index 8716fd5d..22527ed4 100644 --- a/src/maze/mz_wang_tiles.scad +++ b/src/maze/mz_wang_tiles.scad @@ -38,12 +38,12 @@ function mz_wang_tiles(cells, left_border = true, bottom_border = true) = bottom_border ? [for(x = [0:columns - 1]) [x * 2 + 1, 0]] : [ for(x = [0:columns - 1]) let(type = mz_square_get(top_cells[x], "t")) - if(type == "RIGHT_WALL" || type == "NO_WALL") [x * 2 + 1, 1] else [x * 2 + 1, 0] + [x * 2 + 1, type == "RIGHT_WALL" || type == "NO_WALL" ? 1 : 0] ], left_border ? [for(y = [0:rows - 1]) [0, y * 2 + 1]] : [ for(y = [0:rows - 1]) let(type = mz_square_get(right_cells[y], "t")) - if(type == "TOP_WALL" || type == "NO_WALL") [1, y * 2 + 1] else [0, y * 2 + 1] + [type == "TOP_WALL" || type == "NO_WALL" ? 1 : 0, y * 2 + 1] ] ), dot_pts = sort(hashset_elems(hashset(all, hash = function(p) _pt2_hash(p))), by = "vt")