Ad
  • Default User Avatar

    Beautiful but hard to understand the first time

  • Custom User Avatar
  • Default User Avatar

    Much more than size 50 !! I test with size 5 - 80. When size are more than 70, all (x,y) work in almost 1 minute... I just say 5 to 50, your code run with all (x,y) in less than 5 minutes, and some program who use backtracking can't solve only one case, for example, size = 7, x = 0, y=1, in these 5 minutes...
    Size = 5, seem minimum, I think it's because knight's move are 'long' and a little bit strange, in "L"...
    When you talk about heuristic, are min/max algorithms, are an heuristic method ?
    If you are so good in playing chess that you are in coding, it's better I never play against you in chess game ( I'm a very little beginner for this fabulous gama)

    Regards

    Bruno

  • Custom User Avatar

    Thanks! I glad you like this solution!
    It is using "Intelligence" (an Heuristic) vs "Brute Force" (Backtracking)
    It is nice to know that the algoritm also work fine with nxn form 5.. to 50!! Thats is really crazy and with a runtime of less than 5 min... that blob my mind! :)

    Thanks for the fedback an the extra info!
    I hope more chess and coders enthusisats will enjoy it!
    Regards!
    Pablo

  • Default User Avatar

    Congratulation !!! Very good job, I try your code, the fastest code I see here : size from 5 to 50, x from 0 to size, y from 0 to size ( each value test for all, with 3 for loop ... 100 % good result, in less than 5 minutes !!!! I 'll studie your code, because mine, is very long, rought draft and don't send always 100 % good result ^^

  • Default User Avatar

    ok, generator are new for me, my code pass example test, but fail in issue test and random test, I think I make an generator, but it seem not good... how can I have help for my code ?
    Excuse me for fault, english are not my native language.

    Edit = I found a solution, and I verify all solution, I confirm the kata's difficult are not 6 but probably 5 ...

  • Custom User Avatar

    As the task reads, you are asked to write a generator, that continuously yields values of the sequence.
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator

  • Default User Avatar
  • Default User Avatar

    Hi,

    My code are in JS and it seem test don't work. I'm sure my code is good (test on VS code with console.log to read Array returned).

    I have this eror message :

    code length test (// write in green)
    example tests
    TypeError: gen.next is not a function
    at /workspace/node/test.js:33:65
    at Function.from ()
    at /workspace/node/test.js:33:37
    at Context. (test.js:35:25)
    at processImmediate (internal/timers.js:464:21)

    This is the sample example :
    
    const take = length => gen => Array.from( { length }, () => gen.next().value ) ;
    

    it("example tests",()=>{
    assert.deepEqual( take(50)(collatz()), [1, 2, 4, 8, 16, 5, 32, 10, 64, 3, 20, 21, 128, 6, 40, 42, 256, 12, 13, 80, 84, 85, 512, 24, 26, 160, 168, 170, 1024, 48, 52, 53, 320, 336, 340, 341, 2048, 17, 96, 104, 106, 113, 640, 672, 680, 682, 4096, 34, 35, 192] );
    });

    Thank for your response.

  • Default User Avatar

    Very long code !

  • Default User Avatar

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

  • Default User Avatar

    Code of future !!!!

  • Custom User Avatar

    Please use spoiler flag next time.

  • Default User Avatar

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

  • Default User Avatar

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

  • Loading more items...