Ad
  • Custom User Avatar

    For me the problem with the random tests persists... see my issue above

  • Default User Avatar

    @dinglemouse - no problem, it was also kind of fun to figure out what is wrong there :)

    @metawort - all test cases are ok now, I tried also my original solution (where the problem appeared) and it works (all test cases passed)

  • Custom User Avatar

    I'm also seeing the phenomenon that theLift is called twice in the random test cases... Unlike pacman09 I don't see how I can sensibly fix this. I get results like this:

    The first test case always passes, for example:

    R#0: 20 floors, 41 people, lift holds 4

    1. call:
      theLift([[],[0],[0,1],[],[]], 4, [0,1,2,3,4], 0) -> [0,1,2,3,4,2,1,0] // expected result
    2. call:
      theLift([[],[4,3,0,2],[3,0,1],[],[]], 4,, [], 1) -> [0,1,2,3,4,2,1,0] // still expected result

    Noticeably the title of the test cases matches only the capacity used... The first call looks like a intermediate result from the second run (though my algorithm is not recursive). It gets stranger in the subsequent (failing) cases:

    R#1: 15 floors, 17 people, lift holds 3

    1. call:
      theLift([[],[0],[0,1],[],[]], 4, [0], 0) -> [0,2,1,0] // expected result
    2. call:
      theLift([[],[4,3,0,2],[3,0,1],[],[]], 4, [], 1) -> [0,1,2,3,4,2,1,0] // seems correct to me for the input, though

    Despite the different title, the test cases uses the same parameters as the first one, except the third parameter. Fhe input and outpt for all following test cases look identical to this one, including an identical expected result...

  • Custom User Avatar

    @pacman. Yeah that looks bogus to me also. What was supposed to be a recusive call turned into a weird symbiotic relationship with the user solution. Anyway, it's fixed now. Thanks very much for reporting this, and sorry for all the trouble it caused you. The translator will be shot at dawn.

  • Custom User Avatar

    I'm also using TypeScript and am very confused by these parameters! Please at least add and describe them in the instructions.

  • Default User Avatar

    Well, maybe it is by purpose, to test if the solution works correctly also when the lift had already done some progress before calling the function. If yes, mark this issue as resolved.

    Anyway, I was able to update my solution to pass all the tests everytime and this was a great kata!

  • Default User Avatar

    I had luck and one of my attempt tries was successful - all tests passed, so I was able to submit my solution and check the test cases, and I think there is an issue in random test cases for Typescript:
    For the user result, function theLift is called and for the expected result, function myAnswer is called, but inside of function myAnswer function theLift is also called, that means that user implementation is used for expected results.

    I guess this is wrong and function myAnswer should call itself instead of function theLift. Am I right?

  • Default User Avatar

    COMMENT UPDATED AND CHANGED FROM QUESTION TO ISSUE
    (original comment is below, found issue described in reply)

    Coding in TypeScript - I am still getting first random test failed (all the other test are always passed, just first random test R#0 is failed) and no idea why, because sometimes it is really simple test case. Here is the example with logs:

    R#0: 18 floors, 45 people, lift holds 5
    Log
    input parameter result: [ 0, 1 ]
    queues: 
    [ [], [], [ 1 ], [] ]
    capacity: 4
    return: [0, 2, 1, 0]
    input parameter result: undefined
    queues: 
    [ [ 1 ], [], [ 1 ], [] ]
    capacity: 4
    return: [ 0, 1, 2, 1, 0 ]
    expected [ 0, 1, 2, 1, 0 ] to have the same members as [ 0, 2, 1, 0 ]
    

    It looks that there are actually 2 tests, and result from the first is the expected one ([0,2,1,0]), also second result is correct based on the input queues, but the second result is compared with expected result from first test and it is obviously failed.

    Another thing, I don't understand why there are required input parameters result and direction, as you can see in example above, in first test the input parameter result has assigned value [ 0, 1 ] and in second test it is undefined. Maybe this causes the issue, because the second result always contains this result parameter from first test at the beginning. Another example just to see it clearly:

    R#0: 6 floors, 6 people, lift holds 3
    Log
    input parameter result: [ 0, 1, 2, 3, 4 ]
    queues: 
    [ [], [], [ 4, 0, 3 ], [], [] ]
    capacity: 4
    return: [ 0, 2, 3, 4, 2, 0 ]
    input parameter result: undefined
    queues: 
    [ [ 1, 4, 4, 1 ], [ 3, 2 ], [ 3, 4, 0, 3 ], [], [] ]
    capacity: 4
    return: [ 0, 1, 2, 3, 4, 2, 0, 2, 3, 4, 0 ]
    expected [ 0, 1, 2, 3, 4, 2, 0, 2, 3, 4, 0 ] to have the same members as [ 0, 2, 3, 4, 2, 0 ]
    

    You can see that result from first test is expected result, and result from second test starts with the input parameter result from first test ([ 0, 1, 2, 3, 4 ]).

    It is really wierd that all the other complex tests are always passed, only this one fails.
    Am I missing something here or is this an issue of the test?