Earn extra honor and gain new allies!
Honor is earned for each new codewarrior who joins.
Learn more
  • This comment is hidden because it contains spoiler information about the solution

  • This comment is hidden because it contains spoiler information about the solution

  • try with that, plz, if you need to update the random tests (I didn't check the perf against usual generation, so that's the occasion :) )

    
    import numpy as np
    
    def rnd():
        while 1:
            #for v in np.random.uniform(0,1,400):
            for v in np.random.rand(400):
                yield v
    
    RAND   = rnd()
    random = RAND.__next__                     # usual random.random
    choice = lambda lst: lst[rand(len(lst))]
    
    def rand(a,b=None):                        # random.randrange
        if b is None: a,b=0,a
        return a + int( (b-a) * next(RAND) )
    

    EDIT: Seems the random generation isn't the problem, here: my solution still passes in less than 6s with the kata "as is"

  • Thanks for letting me know, I will try and do something about it, be it rewrite random generation with numpy, or maybe wait patiently until issue with python in docker gets resolved :)

  • FYI: Python runner slowness makes this pass only part of the time. I wrote some code, kept timing out at 5th big grid, stopped for the day. Came back the next day, tried again, worked perfectly.

  • The random tests aren't strict enough; I managed to make an initial submission that passes in some cases and fails for others. You should repeat your random tests many, many, many times.

    Each of my submissions takes ~1 second for ~20 tests; in theory you should be able to squeeze in another 50 random tests totally safely.

    With some simple preprocessing I had something like an 80% success rate on my initial solution. With 50 random tests, an 80% success rate would put me at a 0.0014% chance to pass, which seems like a sane margin of error.

  • This comment is hidden because it contains spoiler information about the solution

  • no it is not rigorous. My solution takes only about 2000ms

  • The tests work perfectly fine, and this solution also passes them. If you're having any issues, reset the trainer (this will also fix the sample tests which were indeed broken for Node 10).

  • The test apperars to be bugged. I'd appreciate the fix.

  • This comment is hidden because it contains spoiler information about the solution

  • It appears that tests don't work:

    /home/codewarrior/node/test.js:25
    Test.describe("fixed tests", function() {
    ^

    TypeError: Test.describe is not a function
    at /home/codewarrior/node/test.js:25:6
    at Object. (/home/codewarrior/node/test.js:34:3)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at /home/codewarrior/node/node_modules/.registry.npmjs.org/mocha/5.2.0/node_modules/mocha/lib/mocha.js:250:27
    at Array.forEach ()
    at Mocha.loadFiles (/home/codewarrior/node/node_modules/.registry.npmjs.org/mocha/5.2.0/node_modules/mocha/lib/mocha.js:247:14)
    at Mocha.run (/home/codewarrior/node/node_modules/.registry.npmjs.org/mocha/5.2.0/node_modules/mocha/lib/mocha.js:576:10)
    at Object. (/home/codewarrior/node/node_modules/.registry.npmjs.org/mocha/5.2.0/node_modules/mocha/bin/_mocha:637:18)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

  • JavaScript: Strengthen the random tests so that they could invalidate my solution

  • Loading more items...