Difference between revisions of "User talk:Zyx/Radar Widest Area Angle"
(I think you are right) |
(almost sure is the same thing, one very rare corner case to account for) |
||
Line 6: | Line 6: | ||
: I will add small check to see if turning to the center gives the same result as this code, but I think you are both right, intuitively it seems to have the same output and code is so much simpler :-/. About not adjusting, I call the adjust method in the onScannedRobot event and at the beginning I set to turn radar, gun and bot. But that is for 1v1 and not melee. --[[User:Zyx|zyx]] 05:08, 17 October 2009 (UTC) | : I will add small check to see if turning to the center gives the same result as this code, but I think you are both right, intuitively it seems to have the same output and code is so much simpler :-/. About not adjusting, I call the adjust method in the onScannedRobot event and at the beginning I set to turn radar, gun and bot. But that is for 1v1 and not melee. --[[User:Zyx|zyx]] 05:08, 17 October 2009 (UTC) | ||
+ | |||
+ | My code, and turning to the center gave the exact same answer for over 2000 tests. That's not a formal proof, but is enough for me to think that [[Starrynte]]'s method gives the exact same result using roughly 1/90 lines of code :-). | ||
+ | |||
+ | The only case I can think of were turning to the center fails, is if the bot is spawn facing exactly (to Java's double precision) to the center, so the angle is an exact 0 (very very rare). But it shouldn't be hard to check for this very unlikely, but somewhat possible, situation and turn whatever side you prefer in such a case as the probability is 1/2 for each side. | ||
+ | |||
+ | But thanks to [[Starrynte]] for simplifying my radar code to almost non existent again --[[User:Zyx|zyx]] 05:37, 17 October 2009 (UTC) |
Latest revision as of 06:37, 17 October 2009
In one of my melee bots (now retired), I set the radar, gun, and robot to turn towards the center, and not to adjust gun and radar for robot turn until after 3 ticks. Not sure if this would have a similar effect --Starrynte 01:10, 17 October 2009 (UTC)
- Is disabling 'adjust xxx for yyy turn' really needed? I wouldn't expect it to be needed... hmm --Rednaxela 02:43, 17 October 2009 (UTC)
Hmm... well, I may be mistaken... but thinking this over, I'm pretty sure turning the radar towards the center will always do the same as this 'widest area angle' indeed... --Rednaxela 01:53, 17 October 2009 (UTC)
- I will add small check to see if turning to the center gives the same result as this code, but I think you are both right, intuitively it seems to have the same output and code is so much simpler :-/. About not adjusting, I call the adjust method in the onScannedRobot event and at the beginning I set to turn radar, gun and bot. But that is for 1v1 and not melee. --zyx 05:08, 17 October 2009 (UTC)
My code, and turning to the center gave the exact same answer for over 2000 tests. That's not a formal proof, but is enough for me to think that Starrynte's method gives the exact same result using roughly 1/90 lines of code :-).
The only case I can think of were turning to the center fails, is if the bot is spawn facing exactly (to Java's double precision) to the center, so the angle is an exact 0 (very very rare). But it shouldn't be hard to check for this very unlikely, but somewhat possible, situation and turn whatever side you prefer in such a case as the probability is 1/2 for each side.
But thanks to Starrynte for simplifying my radar code to almost non existent again --zyx 05:37, 17 October 2009 (UTC)