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.
Yes, sir. Thank you !
can you publish now?
I've added random tests but now I cannot publish the kata.
unpublish your kata meanwhile, or it will probably get retired
Yeah, thank you, will add tomorrow.
You should add random tests
Quite short, nice :)
I made this a long time ago. But if I remember correctly, the distance from from cell 1 to cell 2 must always be computed not by abs(x2-x1) + abs(y2-y2) but instead more precisely with pythagorean's theorem sqrt((x2-x1)^2 + (y2-y1)^2)
Using this formula, the distance of the three spaces in your example from the target or start would be 2, ≈1.41, and 2.
So if i remember the kata correctly, the correct answer is the middle one of those three or (1,1) because it is the closest box within the circle of radius = 2 to the target box (2,2)
I don't understand. Take a look at the following setting :
where
$A$
is where you start from and$B$
is the target cell. The cells with the cross$\times$
inside are all equally distant from the target. This means the kata is not consistent as it assumes that there can be only 2 equidistant cells. Am I missing something ?Done ! :)
PRESS
How ? I don't have the Republish button anymore --- only Publish ? Should I press it ?
A reminder: Do not forget to republish this kata.
This comment is hidden because it contains spoiler information about the solution
Everything works now. Don't forget to republish the kata.
By the way, there is another way to solve the problem with local variables:
Local variables are declared inside the
for
block and they are different for each loop iteration.Loading more items...