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.
the word "java" is not similar to "heaven".
kata solution != kata suggestion
Please do not post solution in discourse, and if you intend to post any hints or tips after solving, do apply the Spoiler flag
This comment is hidden because it contains spoiler information about the solution
done some time ago
This was great!
I know this comment was left a while ago but the reason is because using the program is taking to long when using the while loop and random module.
The random module isn't great to use in this case it's not the most reliable. You're basically throwing randoms so may get the same results a few times. The while parameters is a little tricky as well.
This comment is hidden because it contains spoiler information about the solution
Ok, thank you all, I will try to take my time with better understanding my solution and how to improve it.
Your reasoning is more or less okay, the problem is with the test you think to be failing. When I try to run your solution, I see that it fails following test case:
Your solution has a bug which fails for the input above, but it works for the input which you showed and I am not sure what exactly leads you to the conclusion that your solution fails your test, and not the one I found.
You should use
console.log
to print inputs, and probably some other variables too. This way you'll know exactly which test case failed.@hobovsky Thank you for reply. Could you give me example what other test my solution is failing against ?
When I comment out this one test case:
// recipe = {flour: 500, sugar: 200, eggs: 1};
// available = {flour: 1200, sugar: 1200, eggs: 5, milk: 200};
// assert.equal(cakes(recipe, available), 11);
then assertions pass.
Also would you tell me if there is gap or wrong logic in the way I explained this to work ?
Your solution fails other test than you showed above.
Your solution has a bug, it is not a kata issue.
I passed all exampe tests and random tests besides this one(the one random test I append to test suite in example tests):
Based on how logically it would work I would expect having the smaller ratio between same igredient from available divided same ingredient ie. flour in recipe having 500 and flour in available having 1200. I understand it as 1200 / 500 = 2.
Can someone please help me better undestand if this kata random test is correctly done ?
I passed all exampe tests and random tests besides this one(the one random test I append to test suite in example tests):
Based on how logically it would work I would expect having the smaller ratio between same igredient from available divided same ingredient ie. flour in recipe having 500 and flour in available having 1200. I understand it as 1200 / 500 = 2.
Thank you, saved my day!
Loading more items...