Ad
  • Custom User Avatar

    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.

  • Custom User Avatar

    Ahhhh, okay thanks, my mistake, I completely missed the x, y meaning.

  • Custom User Avatar

    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 size 4 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 size 4 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 and y represents the horizontal.

  • Custom User Avatar

    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?

  • Custom User Avatar

    Your distance assumption is correct. If those positions are correct, the 4 blob should move toward the 3 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.

  • Custom User Avatar

    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?