From c9a5faea67e3d9bf895fd79be82471e27ae9dd90 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Tue, 16 Mar 2021 11:45:18 +0800 Subject: [PATCH] refactor --- src/experimental/tiles_wfc.scad | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/experimental/tiles_wfc.scad b/src/experimental/tiles_wfc.scad index 459850da..60f66d70 100644 --- a/src/experimental/tiles_wfc.scad +++ b/src/experimental/tiles_wfc.scad @@ -202,15 +202,12 @@ function neighbor_compatibilities(sample, x, y, width, height) = [for(dir = neighbor_dirs(x, y, width, height)) [me, sample[y + dir[1]][x + dir[0]], dir]]; function compatibilities_of_tiles(sample, width, height) = - let( - neighbor_compatibilities_lt = [ - for(y = [0:height - 1]) - for(x = [0:width - 1]) - for(c = neighbor_compatibilities(sample, x, y, width, height)) - c - ] - ) - hashset(neighbor_compatibilities_lt); + hashset([ + for(y = [0:height - 1]) + for(x = [0:width - 1]) + for(c = neighbor_compatibilities(sample, x, y, width, height)) + c + ]); width = len(sample[0]); height = len(sample);