diff --git a/gulpfile.js b/gulpfile.js index 46f4705c..4730af8f 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -127,6 +127,61 @@ 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 { @@ -138,7 +193,9 @@ function benchmark() { while (runs.length < 100) { const inbox = inboxGenerator.generate(data.level.number); - const outbox = outboxGenerator.generate(data.level.number, inbox); + const outbox = outboxGeneratorPatches[data.level.number] + ? outboxGeneratorPatches[data.level.number](inbox) + : outboxGenerator.generate(data.level.number, inbox); runs.push({ inbox, @@ -190,9 +247,13 @@ function benchmark() { throw 'Program always failing'; } - if (data.successRatio !== 1) { - if (runs[0].success && data.path.type !== 'specific') { - throw `Non-specific program failing on novel inputs (${Math.round( + if (data.successRatio < 1) { + if ( + // Special solutions should pass at least the first example + runs[0].success && + !['specific', 'exploit', 'obsolete'].includes(data.path.type) + ) { + throw `Regular program failing on novel inputs (${Math.round( 100 * data.successRatio, )}% pass)`; } @@ -260,11 +321,9 @@ function buildDataPrograms() { successRatio: data.successRatio, type: data.path.type, legal: - !/(exploit|specific|obsolete)/.test(data.path.type) && - (data.successRatio === 1 || - [4, 28, 41].includes(data.level.number)), - worky: - data.successRatio === 1 || [4, 28, 41].includes(data.level.number), + !['specific', 'exploit', 'obsolete'].includes(data.path.type) && + data.successRatio === 1, + worky: data.successRatio === 1, author: data.path.author, hash: md5(data.source), path: data.path.full, diff --git a/solutions/04-Scrambler-Handler-7.21/14.19.unroll-ad-pro.asm.skip b/solutions/04-Scrambler-Handler-7.21/14.19.unroll-ad-pro.asm similarity index 100% rename from solutions/04-Scrambler-Handler-7.21/14.19.unroll-ad-pro.asm.skip rename to solutions/04-Scrambler-Handler-7.21/14.19.unroll-ad-pro.asm diff --git a/solutions/04-Scrambler-Handler-7.21/19.19.unroll-mrflip.asm.skip b/solutions/04-Scrambler-Handler-7.21/19.19.unroll-mrflip.asm similarity index 100% rename from solutions/04-Scrambler-Handler-7.21/19.19.unroll-mrflip.asm.skip rename to solutions/04-Scrambler-Handler-7.21/19.19.unroll-mrflip.asm diff --git a/solutions/04-Scrambler-Handler-7.21/20.18.unroll-viamodulo.asm.skip b/solutions/04-Scrambler-Handler-7.21/20.18.unroll-viamodulo.asm similarity index 100% rename from solutions/04-Scrambler-Handler-7.21/20.18.unroll-viamodulo.asm.skip rename to solutions/04-Scrambler-Handler-7.21/20.18.unroll-viamodulo.asm diff --git a/solutions/04-Scrambler-Handler-7.21/7.21-atesgoral.asm.skip b/solutions/04-Scrambler-Handler-7.21/7.21-atesgoral.asm similarity index 100% rename from solutions/04-Scrambler-Handler-7.21/7.21-atesgoral.asm.skip rename to solutions/04-Scrambler-Handler-7.21/7.21-atesgoral.asm diff --git a/solutions/28-Three-Sort-34.78/158.68.unroll-viamodulo.asm.skip b/solutions/28-Three-Sort-34.78/158.68.unroll-viamodulo.asm similarity index 100% rename from solutions/28-Three-Sort-34.78/158.68.unroll-viamodulo.asm.skip rename to solutions/28-Three-Sort-34.78/158.68.unroll-viamodulo.asm diff --git a/solutions/28-Three-Sort-34.78/28.115-eiTTio.asm.skip b/solutions/28-Three-Sort-34.78/28.115-eiTTio.asm similarity index 100% rename from solutions/28-Three-Sort-34.78/28.115-eiTTio.asm.skip rename to solutions/28-Three-Sort-34.78/28.115-eiTTio.asm diff --git a/solutions/28-Three-Sort-34.78/28.117.obsolete-esseger.asm.skip b/solutions/28-Three-Sort-34.78/28.117.obsolete-esseger.asm similarity index 100% rename from solutions/28-Three-Sort-34.78/28.117.obsolete-esseger.asm.skip rename to solutions/28-Three-Sort-34.78/28.117.obsolete-esseger.asm diff --git a/solutions/28-Three-Sort-34.78/29.117.obsolete-Eirik0.asm.skip b/solutions/28-Three-Sort-34.78/29.117.obsolete-Eirik0.asm similarity index 100% rename from solutions/28-Three-Sort-34.78/29.117.obsolete-Eirik0.asm.skip rename to solutions/28-Three-Sort-34.78/29.117.obsolete-Eirik0.asm diff --git a/solutions/28-Three-Sort-34.78/31.123.obsolete-Mygod.asm.skip b/solutions/28-Three-Sort-34.78/31.123.obsolete-Mygod.asm similarity index 100% rename from solutions/28-Three-Sort-34.78/31.123.obsolete-Mygod.asm.skip rename to solutions/28-Three-Sort-34.78/31.123.obsolete-Mygod.asm diff --git a/solutions/28-Three-Sort-34.78/32.128.obsolete-albertferras.asm.skip b/solutions/28-Three-Sort-34.78/32.128.obsolete-albertferras.asm similarity index 100% rename from solutions/28-Three-Sort-34.78/32.128.obsolete-albertferras.asm.skip rename to solutions/28-Three-Sort-34.78/32.128.obsolete-albertferras.asm diff --git a/solutions/28-Three-Sort-34.78/33.85-steambap.asm.skip b/solutions/28-Three-Sort-34.78/33.85-steambap.asm similarity index 100% rename from solutions/28-Three-Sort-34.78/33.85-steambap.asm.skip rename to solutions/28-Three-Sort-34.78/33.85-steambap.asm diff --git a/solutions/28-Three-Sort-34.78/34.139.obsolete-clarfonthey.asm.skip b/solutions/28-Three-Sort-34.78/34.139.obsolete-clarfonthey.asm similarity index 100% rename from solutions/28-Three-Sort-34.78/34.139.obsolete-clarfonthey.asm.skip rename to solutions/28-Three-Sort-34.78/34.139.obsolete-clarfonthey.asm diff --git a/solutions/28-Three-Sort-34.78/47.75-jdashton.asm.skip b/solutions/28-Three-Sort-34.78/47.75-jdashton.asm similarity index 100% rename from solutions/28-Three-Sort-34.78/47.75-jdashton.asm.skip rename to solutions/28-Three-Sort-34.78/47.75-jdashton.asm diff --git a/solutions/28-Three-Sort-34.78/49.77-eiTTio.asm.skip b/solutions/28-Three-Sort-34.78/49.77-eiTTio.asm similarity index 100% rename from solutions/28-Three-Sort-34.78/49.77-eiTTio.asm.skip rename to solutions/28-Three-Sort-34.78/49.77-eiTTio.asm diff --git a/solutions/28-Three-Sort-34.78/62.72-popq.asm.skip b/solutions/28-Three-Sort-34.78/62.72-popq.asm similarity index 100% rename from solutions/28-Three-Sort-34.78/62.72-popq.asm.skip rename to solutions/28-Three-Sort-34.78/62.72-popq.asm diff --git a/solutions/28-Three-Sort-34.78/62.73.obsolete-AlanDeSmet.asm.skip b/solutions/28-Three-Sort-34.78/62.73.obsolete-AlanDeSmet.asm similarity index 100% rename from solutions/28-Three-Sort-34.78/62.73.obsolete-AlanDeSmet.asm.skip rename to solutions/28-Three-Sort-34.78/62.73.obsolete-AlanDeSmet.asm diff --git a/solutions/28-Three-Sort-34.78/62.75.obsolete-clarfonthey.asm.skip b/solutions/28-Three-Sort-34.78/62.75.obsolete-clarfonthey.asm similarity index 100% rename from solutions/28-Three-Sort-34.78/62.75.obsolete-clarfonthey.asm.skip rename to solutions/28-Three-Sort-34.78/62.75.obsolete-clarfonthey.asm diff --git a/solutions/41-Sorting-Floor-34.714/188.447.insertion-mrflip.asm.skip b/solutions/41-Sorting-Floor-34.714/188.447.insertion-mrflip.asm similarity index 100% rename from solutions/41-Sorting-Floor-34.714/188.447.insertion-mrflip.asm.skip rename to solutions/41-Sorting-Floor-34.714/188.447.insertion-mrflip.asm diff --git a/solutions/41-Sorting-Floor-34.714/19.734-marcinsmu.asm.skip b/solutions/41-Sorting-Floor-34.714/19.734.specific-marcinsmu.asm similarity index 100% rename from solutions/41-Sorting-Floor-34.714/19.734-marcinsmu.asm.skip rename to solutions/41-Sorting-Floor-34.714/19.734.specific-marcinsmu.asm diff --git a/solutions/41-Sorting-Floor-34.714/196.446.insertion-viamodulo.asm.skip b/solutions/41-Sorting-Floor-34.714/196.446.insertion-viamodulo.asm similarity index 100% rename from solutions/41-Sorting-Floor-34.714/196.446.insertion-viamodulo.asm.skip rename to solutions/41-Sorting-Floor-34.714/196.446.insertion-viamodulo.asm diff --git a/solutions/41-Sorting-Floor-34.714/20.648.selection-mrflip.asm.skip b/solutions/41-Sorting-Floor-34.714/20.648.selection-mrflip.asm similarity index 100% rename from solutions/41-Sorting-Floor-34.714/20.648.selection-mrflip.asm.skip rename to solutions/41-Sorting-Floor-34.714/20.648.selection-mrflip.asm diff --git a/solutions/41-Sorting-Floor-34.714/20.651.selection-sniperrifle2004.asm.skip b/solutions/41-Sorting-Floor-34.714/20.651.selection-sniperrifle2004.asm similarity index 100% rename from solutions/41-Sorting-Floor-34.714/20.651.selection-sniperrifle2004.asm.skip rename to solutions/41-Sorting-Floor-34.714/20.651.selection-sniperrifle2004.asm diff --git a/solutions/41-Sorting-Floor-34.714/20.689-polarathene.asm.skip b/solutions/41-Sorting-Floor-34.714/20.689.specific-polarathene.asm similarity index 100% rename from solutions/41-Sorting-Floor-34.714/20.689-polarathene.asm.skip rename to solutions/41-Sorting-Floor-34.714/20.689.specific-polarathene.asm diff --git a/solutions/41-Sorting-Floor-34.714/208.446.exploit-mrflip.asm.skip b/solutions/41-Sorting-Floor-34.714/208.446.exploit-mrflip.asm similarity index 100% rename from solutions/41-Sorting-Floor-34.714/208.446.exploit-mrflip.asm.skip rename to solutions/41-Sorting-Floor-34.714/208.446.exploit-mrflip.asm diff --git a/solutions/41-Sorting-Floor-34.714/27.639.insertion-sniperrifle2004.asm.skip b/solutions/41-Sorting-Floor-34.714/27.639.insertion-sniperrifle2004.asm similarity index 100% rename from solutions/41-Sorting-Floor-34.714/27.639.insertion-sniperrifle2004.asm.skip rename to solutions/41-Sorting-Floor-34.714/27.639.insertion-sniperrifle2004.asm diff --git a/solutions/41-Sorting-Floor-34.714/28.537.insertion-mrflip.asm.skip b/solutions/41-Sorting-Floor-34.714/28.537.insertion-mrflip.asm similarity index 100% rename from solutions/41-Sorting-Floor-34.714/28.537.insertion-mrflip.asm.skip rename to solutions/41-Sorting-Floor-34.714/28.537.insertion-mrflip.asm diff --git a/solutions/41-Sorting-Floor-34.714/28.705.selection-clarfonthey.asm.skip b/solutions/41-Sorting-Floor-34.714/28.705.selection-clarfonthey.asm similarity index 100% rename from solutions/41-Sorting-Floor-34.714/28.705.selection-clarfonthey.asm.skip rename to solutions/41-Sorting-Floor-34.714/28.705.selection-clarfonthey.asm diff --git a/solutions/41-Sorting-Floor-34.714/30.1061.gnomesort-eiTTio.asm.skip b/solutions/41-Sorting-Floor-34.714/30.1061.gnomesort-eiTTio.asm similarity index 100% rename from solutions/41-Sorting-Floor-34.714/30.1061.gnomesort-eiTTio.asm.skip rename to solutions/41-Sorting-Floor-34.714/30.1061.gnomesort-eiTTio.asm diff --git a/solutions/41-Sorting-Floor-34.714/30.536.insertion-viamodulo.asm.skip b/solutions/41-Sorting-Floor-34.714/30.536.insertion-viamodulo.asm similarity index 100% rename from solutions/41-Sorting-Floor-34.714/30.536.insertion-viamodulo.asm.skip rename to solutions/41-Sorting-Floor-34.714/30.536.insertion-viamodulo.asm diff --git a/solutions/41-Sorting-Floor-34.714/31.546-eiTTio.asm.skip b/solutions/41-Sorting-Floor-34.714/31.546-eiTTio.asm similarity index 100% rename from solutions/41-Sorting-Floor-34.714/31.546-eiTTio.asm.skip rename to solutions/41-Sorting-Floor-34.714/31.546-eiTTio.asm diff --git a/solutions/41-Sorting-Floor-34.714/31.938.insertion-clarfonthey.asm.skip b/solutions/41-Sorting-Floor-34.714/31.938.insertion-clarfonthey.asm similarity index 100% rename from solutions/41-Sorting-Floor-34.714/31.938.insertion-clarfonthey.asm.skip rename to solutions/41-Sorting-Floor-34.714/31.938.insertion-clarfonthey.asm diff --git a/solutions/41-Sorting-Floor-34.714/32.1404.bubblesort-hastebrot.asm.skip b/solutions/41-Sorting-Floor-34.714/32.1404.bubblesort-hastebrot.asm similarity index 100% rename from solutions/41-Sorting-Floor-34.714/32.1404.bubblesort-hastebrot.asm.skip rename to solutions/41-Sorting-Floor-34.714/32.1404.bubblesort-hastebrot.asm diff --git a/solutions/41-Sorting-Floor-34.714/33.570-polarathene.asm.skip b/solutions/41-Sorting-Floor-34.714/33.570.specific-polarathene.asm similarity index 100% rename from solutions/41-Sorting-Floor-34.714/33.570-polarathene.asm.skip rename to solutions/41-Sorting-Floor-34.714/33.570.specific-polarathene.asm diff --git a/solutions/41-Sorting-Floor-34.714/43.621.insertion-dubaaron.asm.skip b/solutions/41-Sorting-Floor-34.714/43.621.insertion-dubaaron.asm similarity index 100% rename from solutions/41-Sorting-Floor-34.714/43.621.insertion-dubaaron.asm.skip rename to solutions/41-Sorting-Floor-34.714/43.621.insertion-dubaaron.asm diff --git a/solutions/41-Sorting-Floor-34.714/69.1534.mergesort-IAmWave.asm.skip b/solutions/41-Sorting-Floor-34.714/69.1534.mergesort-IAmWave.asm similarity index 100% rename from solutions/41-Sorting-Floor-34.714/69.1534.mergesort-IAmWave.asm.skip rename to solutions/41-Sorting-Floor-34.714/69.1534.mergesort-IAmWave.asm diff --git a/solutions/41-Sorting-Floor-34.714/79.488.insertion-mrflip.asm.skip b/solutions/41-Sorting-Floor-34.714/79.488.insertion-mrflip.asm similarity index 100% rename from solutions/41-Sorting-Floor-34.714/79.488.insertion-mrflip.asm.skip rename to solutions/41-Sorting-Floor-34.714/79.488.insertion-mrflip.asm