Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
For me the problem with the random tests persists... see my issue above
@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)
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
theLift([[],[0],[0,1],[],[]], 4, [0,1,2,3,4], 0) -> [0,1,2,3,4,2,1,0] // expected result
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
theLift([[],[0],[0,1],[],[]], 4, [0], 0) -> [0,2,1,0] // expected result
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...
@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.
I'm also using TypeScript and am very confused by these parameters! Please at least add and describe them in the instructions.
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!
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, functionmyAnswer
is called, but inside of functionmyAnswer
functiontheLift
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 functiontheLift
. Am I right?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: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
anddirection
, as you can see in example above, in first test the input parameterresult
has assigned value[ 0, 1 ]
and in second test it is undefined. Maybe this causes the issue, because the second result always contains thisresult
parameter from first test at the beginning. Another example just to see it clearly: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?