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.
C# Translation
ball_test(2, xx___xx_x_xx_x_x_xxx____x______xxx_x_x_xxx____x_____x____x__xx____x_xxxx_xxx__x__x_xx___x___x__x__x_x_x___x______) should be true
Really ?
Edit: Refreshing the page and continuing to test the SAME code eventually resulted in some random tests that my code could pass.
This comment is hidden because it contains spoiler information about the solution
fixed
Distance can never be equal to speed even though both are scalar numbers which can be the same number. They are different dimensions/units related by another dimension/unit, time. The description can make much more sense if you specify that speed is distance-units-per-second. Then you would say "For every second the ball rolls, and for every crack over which it rolls, its speed decreases by 1 unit/second" and "the speed decrease must only take effect at the end of each second."
#include <stdbool.h>is missing in the initial code in CAwful kata requiring mind-boggling special casing until you hit the right 'spot', due to its poor description and dubious interpretations.
ballTest(5, 'xxxxx'));being true bothers me; I think it should be false.Spec says
'return whether or not the ball will be able to make it past the end of the road'
'The ball must fall off of the edge of the road for the code to be considered valid.'
The speed at the end of the road is -1, the ball is stuck on the 5th crack, never to make it past the end of the road.
Terrible details.
You're correct thank you for the feedback! The description has been changed
The last tile has index
roadmap.length - 1though (as strings are zero-indexed), so if the position isroadmap.length, the ball will already have passed the final tile.I am not sure I understand completely what you are trying to say but I will attempt to explain. In your snippet, the program is checking (currentPosition >= roadmap.length) which does not imply that the ball has passed the final tile. It only means that it has reached the final tile. To check if it has passed, you must check (currentPosition > roadmap.length) instead. So the correct solution would use the example shown, meaning that the ball did not necessarily pass the final tile, but may have only reached it instead.
This comment is hidden because it contains spoiler information about the solution
approved by author
#include <stdbool.h>is missing in the initial codeLoading more items...