Package robocode.robotinterfaces.peer
Interface IJuniorRobotPeer
- All Superinterfaces:
IBasicRobotPeer
The junior robot peer for junior robot types like
JuniorRobot
.
A robot peer is the object that deals with game mechanics and rules, and makes sure your robot abides by them.
- Since:
- 1.6
- Author:
- Pavel Savara (original), Flemming N. Larsen (contributor)
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
turnAndMove
(double distance, double radians) Moves this robot forward or backwards by pixels and turns this robot right or left by degrees at the same time.Methods inherited from interface robocode.robotinterfaces.peer.IBasicRobotPeer
execute, fire, getBattleFieldHeight, getBattleFieldWidth, getBodyHeading, getBodyTurnRemaining, getCall, getDistanceRemaining, getEnergy, getGraphics, getGunCoolingRate, getGunHeading, getGunHeat, getGunTurnRemaining, getName, getNumRounds, getNumSentries, getOthers, getRadarHeading, getRadarTurnRemaining, getRoundNum, getSentryBorderSize, getTime, getVelocity, getX, getY, move, rescan, setBodyColor, setBulletColor, setCall, setDebugProperty, setFire, setGunColor, setRadarColor, setScanColor, turnBody, turnGun
-
Method Details
-
turnAndMove
void turnAndMove(double distance, double radians) Moves this robot forward or backwards by pixels and turns this robot right or left by degrees at the same time. The robot will move in a curve that follows a perfect circle, and the moving and turning will end at exactly the same time.Note that the max. velocity and max. turn rate is automatically adjusted, which means that the robot will move slower the sharper the turn is compared to the distance.
Note that both positive and negative values can be given as input:
- If the
distance
parameter is set to a positive value, it means that the robot is set to move forward, and a negative value means that the robot is set to move backward. If set to 0, the robot will not move, but will be able to turn. - If the
radians
parameter is set to a positive value, it means that the robot is set to turn to the right, and a negative value means that the robot is set to turn to the left. If set to 0, the robot will not turn, but will be able to move.
- Parameters:
distance
- the distance to move measured in pixels. Ifdistance
> 0 the robot is set to move forward. Ifdistance
invalid input: '<' 0 the robot is set to move backward. Ifdistance
= 0 the robot will not move anywhere, but just finish its turn.radians
- the amount of radians to turn the robot's body. Ifradians
> 0 the robot's body is set to turn right. Ifradians
invalid input: '<' 0 the robot's body is set to turn left. Ifradians
= 0 the robot's body is set to stop turning.- See Also:
- If the
-