weird bug I'm hitting

Fragment of a discussion from User talk:Voidious
Jump to navigation Jump to search

Wow, good call on the replay file, never looked at one of these before. So it's pretty clear something about the ScannedRobotEvent from the previous tick was wrong - I suspect it's an old ScannedRobotEvent with the wrong time. (I noticed when doing some unit tests that SRE's don't take time in the constructor, guessing they just get it from Robocode engine?)

So here's data I collected from successive ticks in my onScannedRobot:

IMPOSSIBLE: Enemy traveled 23.960320897363644
Round:      3
Ticks:      172 - 173
enemy 1: Point2D.Double[672.296759493604, 268.4670336402143]
enemy 2: Point2D.Double[670.937650031281, 292.3887768662851]
dista 1: 645.4602889259664
dista 2: 643.0225154806783
myloc 1: Point2D.Double[28.46985554539938, 314.3571451334465]
myloc 2: Point2D.Double[28.067090293868013, 306.3672903067204]
heading 1: 3.1650118725284133
heading 2: 3.1919596027245163
bearing 1: -1.5230587899322943
bearing 2: -1.5994228013460932

And here's data for those ticks from the replay:

    <turn round="3" turn="172" ver="1">
      <robots>
        <robot id="0" vsName="ScanTester*" state="ACTIVE" energy="84.0" x="28.46985554539938"
               y="314.3571451334465" bodyHeading="3.1650118725284133" gunHeading="1.6650151674145717"
               radarHeading="1.78588401972672" gunHeat="1.1999999999999997" velocity="8.0"
               teamName="voidious.ScanTester*" name="voidious.ScanTester*" sName="ScanTester*" ver="2">
          <debugProperties/>
          <score name="voidious.ScanTester*" totalScore="116.0" ...<snipped>.../>
        </robot>
        <robot id="1" vsName="Phoenix 1.02" state="ACTIVE" energy="70.10000000000005"
               x="671.8062575598343" y="284.43607160572503" bodyHeading="3.0567611234507766"
               gunHeading="4.4695696509271885" radarHeading="4.843960979524177" gunHeat="0.0"
               velocity="-8.0" teamName="davidalves.Phoenix 1.02" name="davidalves.Phoenix 1.02"
               sName="Phoenix 1.02" bodyColor="FF404040" gunColor="FF404040"
               radarColor="FF00FFFF" ver="2">
          <debugProperties/>
          <score name="davidalves.Phoenix 1.02" totalScore="284.74" ...<snipped>.../>
        </robot>
      </robots>
      <bullets>...<snipped>...</bullets>
    </turn>
    <turn round="3" turn="173" ver="1">
      <robots>
        <robot id="0" vsName="ScanTester*" state="ACTIVE" energy="84.0" x="28.067090293868013"
               y="306.3672903067204" bodyHeading="3.1919596027245163"
               gunHeading="1.641953082596119" radarHeading="1.498022145465518"
               gunHeat="1.0999999999999996" velocity="8.0" teamName="voidious.ScanTester*"
               name="voidious.ScanTester*" sName="ScanTester*" ver="2">
          <debugProperties/>
          <score name="voidious.ScanTester*" totalScore="116.0"...<snipped>.../>
        </robot>
        <robot id="1" vsName="Phoenix 1.02" state="ACTIVE" energy="68.11000000000006"
               x="670.937650031281" y="292.3887768662851" bodyHeading="3.0328022439880638"
               gunHeading="4.449386601269055" radarHeading="4.698449464559538" gunHeat="1.298"
               velocity="-8.0" teamName="davidalves.Phoenix 1.02" name="davidalves.Phoenix 1.02"
               sName="Phoenix 1.02" bodyColor="FF404040" gunColor="FF404040"
               radarColor="FF00FFFF" ver="2">
          <debugProperties/>
          <score name="davidalves.Phoenix 1.02" totalScore="284.74"...<snipped>.../>
        </robot>
      </robots>
      <bullets>...<snipped>...</bullets>
    </turn>

So my location and heading is right for both ticks, enemy location on the latter tick is right, but wrong for the previous tick. The e.getDistance() is in the same ballpark, but the bearing has to be way off to have projected a point 24 distance away from the next tick. (Didn't actually do the math...)

This definitely only happens at high speeds / loads. This is a modified Jen and I couldn't get it to happen vs Raiko until I added a few hundred thousand sqrt operations into the run loop. It happened against Phoenix without any such hacks. Both only when minimized.

Voidious19:52, 2 June 2012