Ad
  • 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

    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.