diff --git a/gulpfile.js b/gulpfile.js index 4730af8f..a19f318e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -127,61 +127,6 @@ function inspect() { }); } -/** Temp patches until the package is fixed and updated */ -function splitGroups(arr, groupSize) { - var strings = [], - zeroPos; - - for (var i = 0; i < arr.length; i += groupSize) { - strings.push(arr.slice(i, i + groupSize)); - } - - return strings; -} - -function splitStrings(arr) { - var strings = [], - zeroPos; - - while (arr.length) { - zeroPos = arr.indexOf(0); - strings.push(arr.slice(0, zeroPos)); - arr = arr.slice(zeroPos + 1); - } - - return strings; -} - -const outboxGeneratorPatches = { - 4: function (inbox) { - // Output each pair with the items in reverse order - return splitGroups(inbox, 2).reduce(function (outbox, pair) { - return outbox.concat(pair.reverse()); - }, []); - }, - 28: function (inbox) { - // For each triple, sort then output - return splitGroups(inbox, 3).reduce(function (outbox, triplet) { - return outbox.concat(triplet.sort((a, b) => a - b)); - }, []); - }, - 41: function (inbox) { - // Split strings, sort items in each string, then output all strings - return splitStrings(inbox) - .map(function (string) { - return string - .map((n) => parseInt(n, 36)) - .sort((a, b) => a - b) - .map((n) => n.toString(36).toUpperCase()); - }) - .reduce(function (output, string) { - return output.concat(string); - }); - }, -}; - -/** End of temp patches */ - function benchmark() { return plugins.tap((file) => { try { @@ -193,9 +138,7 @@ function benchmark() { while (runs.length < 100) { const inbox = inboxGenerator.generate(data.level.number); - const outbox = outboxGeneratorPatches[data.level.number] - ? outboxGeneratorPatches[data.level.number](inbox) - : outboxGenerator.generate(data.level.number, inbox); + const outbox = outboxGenerator.generate(data.level.number, inbox); runs.push({ inbox, diff --git a/package.json b/package.json index 61689a46..69000352 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "hrm-cpu": "^0.2.3", "hrm-level-data": "^1.1.2", "hrm-level-inbox-generator": "0.0.4", - "hrm-level-outbox-generator": "0.0.2", + "hrm-level-outbox-generator": "^1.0.0", "hrm-parser": "^0.2.2", "marked": "^5.0.0", "md5": "^2.3.0", diff --git a/yarn.lock b/yarn.lock index 92a0643f..58f7e94c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1808,10 +1808,10 @@ hrm-level-inbox-generator@0.0.4: hrm-level-data "^1.0.0" mersenne-twister "^1.0.1" -hrm-level-outbox-generator@0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/hrm-level-outbox-generator/-/hrm-level-outbox-generator-0.0.2.tgz#017dcde92ce5e8cbcc7e8cbc533540be88429610" - integrity sha512-6Ev8EpD5qzrkaOHoyel/9i9eAFfEWacT8GCYM5LGgtFRbWmKvwFE8oxxQ3L0iDNrJmoqWQuqqYN09h/j5bo+1w== +hrm-level-outbox-generator@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/hrm-level-outbox-generator/-/hrm-level-outbox-generator-1.0.0.tgz#f0f652e8fcd7620529deaf9138b65cc6702911c6" + integrity sha512-608eOCzWIMPbVf8z5RqwjsfnEieUJgZdun6LtiEdE6UBxGwWULYx/zGCWYSOhj50G4yjorqH8h5nBezGj3q0Jw== dependencies: hrm-level-data "^1.1.0" quick-primefactors "^1.0.0"