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.
Hi,
I've tried multiple things and am unable to replicate the issue (in Python).
print(n)
will correctly output the input in the log.n = 86: 86 should equal (1, 101)
Please open another issue with more information if you believe it is still occurring.
I believe I have fixed this and added 'closeTo' assertions using expects' in-built methods.
The only errors are logical errors when the gallery width is >= 700.
Hey, you said that this is the solution? But "setUpGallery" isn't named correctly, the values are rounded, and the Image objects aren't returned as rows.
Can you please provide the updated code where you got the 'floating point error'.
This will prevent me from wasting time trying to recreate your solution and getting it wrong.
Could you please send your solution over so I can look into it further? Post it in Discord at "help-author" if that is better.
@theunbeatableant
Although... that might be quite complicated to do with a 2D array of Image objects. If I were to implement fuzzy assertion, then I would appreciate any guidance you could give.
I could implement a 0.001 tolerance on either side of the expected value, that will definitely fix the errors.
However, is you solution supposed to give the correct answers? If so, I will implement that now and that should fix everything.
Hi Voile, massive thanks for the clear and detailed explanation.
OOP
structure changed to a JavaScript function..to.deep.equal()
instead ofJSON.stringify()
chai.config.truncateThreshold = 0
2D array
ofImage
objects.Hope this fixes any issues you raised :)
I made sure to remove the Math.round() from the solution and it looks like the solution is no longer passing the tests!
(The actual image dimensions are different even though the return output is now a 2D array)
Perhaps I should use truncation instead to avoid language inconsistencies?
Ahh I was unaware that rounding could be mistaken for truncating, but after searching online I really can't find any sources where truncating is mistaken for rounding. I believe that using the term 'rounding' is appropriate when talking about rounding up or down based on whether the decimal part is
>= 0.5
or< 0.5
. x.5 should be rounded up :)Since my kata is about web development, it should just be for JavaScript, but yes I will take your comment about different languages into consideration.
With regards to the applicable order of operations I was thinking of 2 methods:
Surely rounding after all calculations should be fine? If I have done the same anyways.
I've go with rounding! Hopefully I won't come across any other issues, but if I do I will head over to the Codewars Discord :)
Reasons for choosing rounding:
Yeah I was very confused with what to do regarding the floating point values.
Could you please elaborate further with what you mean by using rational numbers? Perhaps I could add a ± 0.5 error in the tests? I would prefer to use integers, but of course the integer divisions may result in recurring decimals???
I think I've fixed this... Please correct me if the tests can still be bypassed!
Sounds pretty confusing, thanks for both your responses 👍
This comment is hidden because it contains spoiler information about the solution
Loading more items...