From f5e403bbf05a342607d4083d7555e5b0cfda4657 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Tue, 15 Mar 2022 20:49:29 +0800 Subject: [PATCH] refactor --- src/maze/mz_hamiltonian.scad | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/maze/mz_hamiltonian.scad b/src/maze/mz_hamiltonian.scad index 393ab45a..fb48bfcf 100644 --- a/src/maze/mz_hamiltonian.scad +++ b/src/maze/mz_hamiltonian.scad @@ -26,12 +26,11 @@ function mz_hamiltonian(rows, columns, start = [0, 0], seed) = let( x = mz_square_get(cell, "x"), y = mz_square_get(cell, "y"), - type = mz_square_get(cell, "t"), - pts = type == "TOP_WALL" ? _mz_hamiltonian_top(x, y) : - type == "RIGHT_WALL" ? _mz_hamiltonian_right(x, y) : - type == "TOP_RIGHT_WALL" ? _mz_hamiltonian_top_right(x, y) : [] + type = mz_square_get(cell, "t") ) - each pts + each if(type == "TOP_WALL") _mz_hamiltonian_top(x, y) else + if(type == "RIGHT_WALL") _mz_hamiltonian_right(x, y) else + if(type == "TOP_RIGHT_WALL") _mz_hamiltonian_top_right(x, y) ], [for(x = [0:columns * 2 - 1]) [x, 0]], [for(y = [0:rows * 2 - 1]) [0, y]]