Difference between revisions of "Stop And Go Tutorial"
(Creating the article ;)) |
(continuing...) |
||
Line 1: | Line 1: | ||
== What is Stop And Go? == | == What is Stop And Go? == | ||
− | Stop And Go is a very popular movement among [[NanoBots]] and [[MicroBots]]. It's extremely powerful against simple targeting methods as [[ | + | Stop And Go is a very popular movement among [[NanoBots]] and [[MicroBots]]. It's extremely powerful against simple targeting methods as [[Head-On Targeting]], [[Linear Targeting]] or [[Circular Targeting]], however, it's extremely useless against advanced targetings for example [[Pattern Matching]] guns. For more details take a look at the 'official' [[Stop And Go]] page. |
== But how it works? == | == But how it works? == | ||
− | Generally, [[Stop And Go]] means moving a bit when the enemy fires and stopping before its next firing. It confuses [[Linear Targeting]] and [[Circular Targeting]], because at the time of firing our bot stands still, so they work as [[ | + | Generally, [[Stop And Go]] means moving a bit when the enemy fires and stopping before its next firing. It confuses [[Linear Targeting]] and [[Circular Targeting]], because at the time of firing our bot stands still, so they work as [[Head-On Targeting]] which is useless against all one-way movements. |
== Okay, but how does it look like in a code? == | == Okay, but how does it look like in a code? == | ||
− | + | Now I show you how I implemented it in my nanos. <br><br> | |
− | + | First and foremost, the most important part of [[Stop And Go]] is keeping track of the enemy's previous energy. The difference between the previous and the actual energy state gives the necessary data to decide whether the enemy fired or not. So you should create a global variable for it. Of course, you should update it every turn you see the enemy. | |
+ | <pre> | ||
+ | . | ||
+ | . | ||
+ | . | ||
+ | static double prevEnergy = 100.0; | ||
+ | . | ||
+ | . | ||
+ | . | ||
+ | public void onScannedRobot(ScannedRobotEvent e){ | ||
+ | ...//energy monitoring | ||
+ | prevEnergy = e.getEnergy(); | ||
+ | } | ||
+ | </pre> | ||
[[Category:Movement]] | [[Category:Movement]] | ||
[[Category:Movement Implementations]] | [[Category:Movement Implementations]] | ||
[[Category:Tutorials]] | [[Category:Tutorials]] |
Revision as of 17:22, 4 September 2008
What is Stop And Go?
Stop And Go is a very popular movement among NanoBots and MicroBots. It's extremely powerful against simple targeting methods as Head-On Targeting, Linear Targeting or Circular Targeting, however, it's extremely useless against advanced targetings for example Pattern Matching guns. For more details take a look at the 'official' Stop And Go page.
But how it works?
Generally, Stop And Go means moving a bit when the enemy fires and stopping before its next firing. It confuses Linear Targeting and Circular Targeting, because at the time of firing our bot stands still, so they work as Head-On Targeting which is useless against all one-way movements.
Okay, but how does it look like in a code?
Now I show you how I implemented it in my nanos.
First and foremost, the most important part of Stop And Go is keeping track of the enemy's previous energy. The difference between the previous and the actual energy state gives the necessary data to decide whether the enemy fired or not. So you should create a global variable for it. Of course, you should update it every turn you see the enemy.
. . . static double prevEnergy = 100.0; . . . public void onScannedRobot(ScannedRobotEvent e){ ...//energy monitoring prevEnergy = e.getEnergy(); }