diff --git a/src/experimental/_impl/_tiles_wfc_impl.scad b/src/experimental/_impl/_tiles_wfc_impl.scad index ffe9a3b7..788e3a89 100644 --- a/src/experimental/_impl/_tiles_wfc_impl.scad +++ b/src/experimental/_impl/_tiles_wfc_impl.scad @@ -113,12 +113,12 @@ function wf_entropy(wf, x, y) = ln(sumOfWeights) - (sumOfWeightLogWeights / sumOfWeights); function _wf_entropy(weights, states, state_leng, sumOfWeights, sumOfWeightLogWeights, i = 0) = -i == state_leng ? [sumOfWeights, sumOfWeightLogWeights] : -let( - opt = states[i], - weight = hashmap_get(weights, opt) -) -_wf_entropy(weights, states, state_leng, sumOfWeights + weight, sumOfWeightLogWeights + weight * ln(weight), i + 1); + i == state_leng ? [sumOfWeights, sumOfWeightLogWeights] : + let( + opt = states[i], + weight = hashmap_get(weights, opt) + ) + _wf_entropy(weights, states, state_leng, sumOfWeights + weight, sumOfWeightLogWeights + weight * ln(weight), i + 1); function _replaceStatesAt(wf, x, y, states) = let(