Everything Robocode

robocode

Movement

Movement is one of the most important part of your robot. Without it your robot is a sitting duck.

There are multiple movement commands:

Basic robot:
ahead(int d); moves ahead d number of pixels.
back(int d); moves back d number of pixels.
turnRight(int d); turns d degrees to the right.
turnLeft(int d); turns d degrees to the left.
Advanced robot:
setAhead(int d); returns right away and moves ahead d number of pixels.
setBack(int d); returns right away and moves back d number of pixels.
setTurnRight(int d); returns right away and turns d degrees to the right.
setTurnLeft(int d); returns right away and turns d degrees to the left.

Types of movement

Random: makes a random direction for the robot to move in using math.random() * 360 (math.random give a number between 0 and 1)

Wave surfing: avoid bullets by taking into account where the enemy fired previously

Antigravity movement: uses vectors to create imaginary force fields around an imaginary bullet to push it away.

You are viewing the text version of this site.

To view the full version please install the Adobe Flash Player and ensure your web browser has JavaScript enabled.

Need help? check the requirements page.


Get Flash Player