1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-22 14:23:23 +02:00

refactor: clean variables

This commit is contained in:
Justin Lin
2022-03-20 18:10:43 +08:00
parent 6f13757cbc
commit 03563afb6f

View File

@@ -116,11 +116,10 @@ function wf_not_collapsed_coords(wf) = [
function wf_coord_min_entropy(wf) = function wf_coord_min_entropy(wf) =
let( let(
coords = wf_not_collapsed_coords(wf), coords = wf_not_collapsed_coords(wf),
coords_leng = len(coords),
entropyCoord = coords[0], entropyCoord = coords[0],
entropy = wf_entropy(wf, entropyCoord.x, entropyCoord.y) - (rand() / 1000) entropy = wf_entropy(wf, entropyCoord.x, entropyCoord.y) - (rand() / 1000)
) )
_wf_coord_min_entropy(wf, coords, coords_leng, entropy, entropyCoord); _wf_coord_min_entropy(wf, coords, len(coords), entropy, entropyCoord);
function _wf_coord_min_entropy(wf, coords, coords_leng, entropy, entropyCoord, i = 1) = function _wf_coord_min_entropy(wf, coords, coords_leng, entropy, entropyCoord, i = 1) =
i == coords_leng ? entropyCoord : i == coords_leng ? entropyCoord :
@@ -156,15 +155,13 @@ function tilemap_compatibilities(tm) = tm[2];
function tilemap_wf(tm) = tm[3]; function tilemap_wf(tm) = tm[3];
function tilemap_check_compatibilities(tm, tile1, tile2, direction) = function tilemap_check_compatibilities(tm, tile1, tile2, direction) =
let(compatibilities = tilemap_compatibilities(tm)) hashset_has(tilemap_compatibilities(tm), [tile1, tile2, direction]);
hashset_has(compatibilities, [tile1, tile2, direction]);
function tilemap_propagate(tm, x, y) = function tilemap_propagate(tm, x, y) =
let(stack = create_stack([x, y])) _tilemap_propagate(tm, create_stack([x, y]));
_tilemap_propagate(tm, stack);
function _tilemap_propagate(tm, stack) = function _tilemap_propagate(tm, stack) =
stack_len(stack) == 0 ? tm : stack == [] ? tm :
let( let(
current_coord = stack[0], current_coord = stack[0],
cs = stack[1], cs = stack[1],