Resources – Robocode

SentryBot code

Robocode 2024 official version


SentryBot behaviour used for Robocode Ireland 2023 Competition

We started Robocode Competitions in 2003, Robocode was redesigned in 2014 so that a robot receives no energy or points for hitting the SentryBot, this approach will be used for 2024

In 2014 we implemented a new BorderSentry class to achieve this which uses the idea of a BorderArea (coloured red) which allows the SentryBot to cause damage to robots. If the robots are in the “safe zone” (coloured blue) the SentryBot bullets do not cause any damage. We recommend a safe zone of 100×100 in the middle of the screen which implies a border area of 300. The safe zone concept only applies to bullets from the SentryBot.

Robocode can be downloaded directly from the Robocode web site the version we will use for 2023 is

The SentryBot should be placed in c:\robocode\robots\sentry. SentryBot (you will need to extract the zip file and copy the robot to the folder c:\robocode\robots\sentry)

You also need to configure inside Robocode the Options->Preferences sub menu to show the Sentry Border Area (in red) . Tick the box beside the option Visible Sentry Border

The Robocode Arena for 2023 has the following properties:

Battlefield Size – 800×800

Sentry Border Size 300

The SentryBot has the following properties:

  • Spawns randomly along the edge and does not move
  • Robots receive no energy or points for hitting it
  • If a robot is in the safe zone when hit by the SentryBot bullet it receives no damage
  • Utilises linear targeting, this means that robots that move in straight lines will be easy targets, robots that move in random directions, curves or parabolas will be difficult targets
  • Target Acquisition Algorithm (lines 392 to 438)
    • Set the target robot to be the one that exhibits the largest change in X or Y from the previous scan
    • Each robot has a delta value which is either the change in X or Y (whichever is larger)
    • maxDelta decides which robot becomes the target
    • If a robots delta is greater than maxDelta it becomes the new target
    • Robots inside safe zone will not be damaged by fire from the sentry robot