From 7e66869bcaa046429db7254c40c3d6eb041d1d71 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Mon, 21 Mar 2022 14:59:05 +0800 Subject: [PATCH] refactor: rename --- src/experimental/_impl/_tiles_wfc_impl.scad | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/experimental/_impl/_tiles_wfc_impl.scad b/src/experimental/_impl/_tiles_wfc_impl.scad index 74631c0b..f7233d62 100644 --- a/src/experimental/_impl/_tiles_wfc_impl.scad +++ b/src/experimental/_impl/_tiles_wfc_impl.scad @@ -72,10 +72,10 @@ function _wf_collapse(wf, x, y, states, weights, leng, threshold, i = 0) = // Shannon entropy function wf_entropy(wf, x, y) = let( - weights = wf_weights(wf), - states_weights = [for(state = wf_eigenstates_at(wf, x, y)) hashmap_get(weights, state)], - sumOfWeights = sum(states_weights), - sumOfWeightLogWeights = sum([for(w = states_weights) w * ln(w)]) + all_weights = wf_weights(wf), + weights = [for(state = wf_eigenstates_at(wf, x, y)) hashmap_get(all_weights, state)], + sumOfWeights = sum(weights), + sumOfWeightLogWeights = sum([for(w = weights) w * ln(w)]) ) ln(sumOfWeights) - (sumOfWeightLogWeights / sumOfWeights);