From a3d78b7ddc5aa936d42f2952b9bbab5cd5820dfd Mon Sep 17 00:00:00 2001 From: Ian Coleman Date: Thu, 10 Nov 2016 10:54:43 +1100 Subject: [PATCH] Dice conversion to Base 6 uses arrays not strings --- src/js/entropy.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/js/entropy.js b/src/js/entropy.js index c804fda..cf981ff 100644 --- a/src/js/entropy.js +++ b/src/js/entropy.js @@ -70,23 +70,22 @@ window.Entropy = new (function() { // Convert dice to base6 entropy (ie 1-6 to 0-5) // This is done by changing all 6s to 0s if (base.str == "dice") { - var newRawEntropyStr = ""; + var newParts = []; var newInts = []; - for (var i=0; i -1) { - newRawEntropyStr += c; + newParts[i] = base.parts[i]; newInts[i] = base.ints[i]; } else { - newRawEntropyStr += "0"; + newParts[i] = "0"; newInts[i] = 0; } } - rawEntropyStr = newRawEntropyStr; base.str = "base 6 (dice)"; base.ints = newInts; - base.parts = matchers.base6(rawEntropyStr); + base.parts = newParts; base.matcher = matchers.base6; } // Detect empty entropy -- 2.41.0