Beta

Dota 2 Bots - Pudge's Meat Hook

10 of 16docgunthrop
Description
Loading description...
Mathematics
Geometry
Games
Algorithms
  • Please sign in or sign up to leave a comment.
  • Voile Avatar

    There is a big class of edge case missing: when enemy is inside the range and would exit the range before meat hook can even reach the enemy, even if meat hook was fired at t = 0. For instance:

    { speed: 500, start: [ 1099, -100 ], end: [ 1099, 100 ] }
    

    At level 1 (r = 1100) this is outside the circle and takes ~106ms for the enemy to leave the circle, when the hook needs at least ~700ms to close in to the enemy.

    Reference solution can't handle this properly: instead of returning null (the enemy can't be hooked in this case) it expects [[1099, 292], 0], which is clearly nonsensical as it is outside the circle.

  • Voile Avatar

    Need to add edge case of pure horizontal and vertical movement for the enemy: this solution can't handle vertical enemy movement.

  • Voile Avatar

    The t = 0 test case is not tested frequently enough in random tests (at least not enough to stop me from passing the kata after repeated submissions), and for the 3 fixed tests they can be hard-coded.

  • Voile Avatar

    The link to the embedded video in the description is dead ;-(

  • ᛚᚨᚱᛊ ᚺᛖᚾᚱᛁᚲ Avatar

    This comment has been hidden.

  • ᛚᚨᚱᛊ ᚺᛖᚾᚱᛁᚲ Avatar

    This comment has been hidden.

  • docgunthrop Avatar

    Updated Description and added new reference image.

  • user7189978 Avatar
    { speed: 427,
      start: [98, 1410],
      end: [649, -745] }
    
    Expected: [[179, 1094], 0], instead got: [[178, 1097], 0]
    

    I'm passing every sample test in Python, but when I attempted to submit final I can't pass this test. I've scratched my head and gone over my equations a good amount of times, when I finally decided to graph it in Desmos and notice the 'correct' solution isn't even on the enemy's ray of movement. https://i.imgur.com/hmgnmDo.png

    • docgunthrop Avatar

      In the Description under the Output header:

      • contact point ([x,y]) of the hookshot if the enemy can be hooked (rounded to nearest integers)

      In your graph the line passes around the x-coordinate 178.8, which rounds to 179.

      Also it looks like the timing for the two moving objects is off for your solution. After finding the slope and distance, we find that the runner reaches the "hook contact" coordinates at the 0.7565852776832743 second mark, whereas the kata has 0.7639723325225893 seconds.

      If Pudge launches his hook toward the point you got, it takes 0.7664464692655989 seconds, which means he misses his target because it's off by ~`10ms. If Pudge launches toward the kata's expected point, it takes0.7645153431221661` seconds, which rounds to the same time in milliseconds as the runner.

  • docgunthrop Avatar

    Python translation published.

  • ZED.CWT Avatar
    { speed: 440,
      start: [ 911, -1774 ],
      end: [ 1585, -2833.4599341383096 ] }
      
    Expected: [[1395, -2534], 53], instead got: [[427, -1014], 1290]
    

    Though my answer was not correct Do you really think that it can reach the target (1395**2+2534**2)**.5==2892 dst away ?