Knowledge Base‎ > ‎Programming‎ > ‎

Robocode Using Python

Robocode and Python - Getting Started

Subpage Listing

Robocode is a programming game where you build the AI that controls a tank that battles against other tanks. Tanks are usually build in Java but it is possible to use Python to program your tank. This page is to act as a starting point for working with Robocode and Python in a high school classroom setting. Junior Robot is a simplified tank type in Robocode suitable for learning.

Robocode Quick Start

Read this. Take some notes or questions to ask your teacher.

Robot / Game Physics  |  

Radar  |  Movement |  

Targeting  |  

Python tanks with sample Java tanks - SpinBot and SittingDuck (click for larger version)


Sitting Duck  |  Crazy  | Corners


Open Code 1x1 |  Mini Meele | Legue Python/Java (and Ruby/Javascript/?) | Proposed Legues

Advanced Topics

Tutorials | Java Code Snippets (Java) | 

Java Example Bots  |  Wiki  Small bots: Nanobots  Minibots  Microbots

Python robots compete with SittingDuck and SpinBot - two of the sample Java robots


Junior robots are slightly simplified versions of the regular (and other) robot types. It is assumed you have a working idea of Python at this point and understand basic programming (variables, types, loops, conditionals and functions). Some experience coding some graphics (with Python and Processing for instance) would be a real asset. Knowledge of Object Orientated programming is not required throughout these lessons, but it will be introduced and explored a bit.

Fields / Tank and Game Information

Robot        energy  heading  robotX  robotY
                  hitWallAngle  hitWallBearing

Colours     black  blue  brown  gray  green  orange  purple  red  white  yellow

Methods / Making Your Robot Tank Do Something

Robot         doNothing  run  setColors  
Scanner     onScannedRobot

Damage     onHitByBullet

Advanced Topics

Subpages (1): Python Setup