What version of robocode? Older versions had funky teleport bugs. --Chase-san
Wow, your code is like, is in a older style (enumeration, vectors, hashtables). In your evaluate near the bottom, you have while(i.hasNext()){ just after you define a new Iterator, did you mean to use that iterator for that while loop? (you could just reuse the iterator by reassigning it btw, just remove "Iterator d" friom the first part of that). As for your little bug I can't be sure without doing a full trace, but I think it might be a problem in your extrapolate method. If can run a simple check (if(location.getX() < 0 || location.getX() > 800 || location.getY() < 0 || location.getY() > 600) out.println("ERROR! at line <line num>"); --Chase-san
Hmm, did a little test, and these were the results (cropped to a few lines of the output, although most of it is similar to this):
X WRONG: timeDelta=1.0 velocity=6.0 heading=2.9309882324026777 orig x=999.2743866043156 Y WRONG: timeDelta=1.0 velocity=6.0 heading=2.9309882324026777 orig y=-737.2268427985015 X WRONG: timeDelta=1.0 velocity=6.0 heading=2.9309882324026777 orig x=1000.5286926303485 Y WRONG: timeDelta=1.0 velocity=6.0 heading=2.9309882324026777 orig y=-743.0942712295143 X WRONG: timeDelta=1.0 velocity=6.0 heading=2.9309882324026777 orig x=1001.7829986563813 Y WRONG: timeDelta=1.0 velocity=6.0 heading=2.9309882324026777 orig y=-748.9616996605272 X WRONG: timeDelta=1.0 velocity=6.0 heading=2.9309882324026777 orig x=1003.0373046824142 Y WRONG: timeDelta=1.0 velocity=6.0 heading=2.9309882324026777 orig y=-754.82912809154meaning it must be in onScannedRobot...it began to say that around the 11th tick. Did another test, and it began at the 5th tick. The 'onCustomEvent' for the tick works fine, so it's not a 'myPosition' update problem --Starrynte
Wrong test earlier, forgot to take into account abs value and was accidentally comparing x instead of y...but still similar results Another test shows that the onScannedRobot is assigning the enemy position corretly...im wondering if I modified the enemy position in any way besides in onScannedRobot...a quick search shows im not. And i have robocode 1.3.4 Perhaps i should tweak with 1v1 first...--Starrynte
1v1 no problem. Added nano's code for finding the intersection of a line with a shape. melee, still problems with the 'original position'. --Starrynte
Your 'tick' condition looks suspicious to me...for example if you stop moving, and haven't fired, but you've turned, the e.getBearing() in onScannedRobot will be of a heading other than the recorded heading. I would use
return getTime() != time;as a condition. -- Skilgannon
Why is it that I always miss the obvious?! Thnx for the suggestion, still doesn't really work, thnx still. Oh and btw, the problem occurs more often the more the bots there are. It usually occurs with the bots it hasn't scanned for awhile.--Starrynte (post edited)