IBasicRobotPeer Move Method Robocode Robot API for .NET
Immediately moves your robot forward or backward by distance measured in pixels.

This call executes immediately, and does not return until it is complete, i.e. when the remaining distance to move is 0.

If the robot collides with a wall, the move is complete, meaning that the robot will not move any further. If the robot collides with another robot, the move is complete if you are heading toward the other robot.

Note that both positive and negative values can be given as input, where positive values means that the robot is set to move forward, and negative values means that the robot is set to move backward.

Examples

// Move the robot 100 pixels forward
Ahead(100);

// Afterwards, move the robot 50 pixels backward
Ahead(-50);

Namespace: Robocode.RobotInterfaces.Peer
Assembly: robocode (in robocode.dll) Version: 1.9.3.0
Syntax

void Move(
	double distance
)

Parameters

distance
Type: OnlineSystem Double
The distance to move measured in pixels. If distance > 0 the robot is set to move forward. If distance < 0 the robot is set to move backward. If distance = 0 the robot will not move anywhere, but just finish its turn.
See Also