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.
#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 - 1
though (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 codeТочно... Скорость уменьшается - пропорционально уменьшается пройденное расстояние.
C Translation
If the range is 62 and the speed is 10 and the ball can only travel 10+9+8...+1 then the ball will only end up traveling 55 units before the speed is 0
test.assert_equals(ball_test(10, '______________________________________________________________'), False)
Velocity equal 10
Range equal 62
Speed decrease 6
Remaining speed 4
Why result in 7 Test is False?
not working all, but code is corect
Loading more items...