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.
Clever, but wrong. It would permit lat as 90.50 or long as -180.3; parsing should consider the whole number with optional fractional part, but that doesnt seem to be tested in validation.
Ahhhh, okay thanks, my mistake, I completely missed the x, y meaning.
For that test case, there are three blobs of size
3
;{x:3,y:6,size:3}, {x:9,y:6,size:3}, {x:5,y:6,size:3}
. The size4
blob ({x:8,y:3,size:4}
) will move toward the blobs that are closest based on movement distance, which includes just the latter two. The[9, 6]
blob is roughly at 4 o'clock while the[5, 6]
blob is between 1 and 2 o'clock, relative to the size4
blob. This means the predatory blob moves toward the latter and ends up at[7, 4]
.EDIT: keep in mind that
x
represents the vertical position andy
represents the horizontal.Thanks for the response, so looking into the default test cases for the kata at line 45-48 it sets
up a new Blob instance and do a single move(), looking into the hardcoded expected result it lists
that [8,3,4] goes to [7,4,4] and not to [9,4,4] as should be expected by the example I gave above.
Is this test expected result wrong?
Your distance assumption is correct. If those positions are correct, the
4
blob should move toward the3
blob in the 1-h position as you noted.Just a note, remember to make sure your solution is taking into account how to handle invalid inputs because that will affect the results.
Regarding the second group of tests in the given test cases, on the upper right side of the initial grid it gives:
x x 1 x x
3 x x x 3
x x x x x
x x x x x
6 x x 4 x
I believe that both 3s count as distance 3 from the 4, so the priority rule should kick in.
Now the test says that the 4 moves toward the left 3, but according to the clock rule this
is roughly 10-h position while the right one if kinda 1-h position.
So which 3 should be the correct target? Or is my distance assumption wrong?