Tanks is a game in which you pit your coding abilities against other hackers. You write a program for your tank, set it out on the battlefield, and watch how it fares against other tanks while running your program.
Each tank has a turret-mounted laser, two treads, up to ten sensors, and a diagnostic LED. Sensors are used to detect when other tanks are inside a given arc. In the examples on this page, "triggered" sensors turn black. Most tanks will take some action if a sensor is triggered, such as changing speed of the treads, turning the turret, or firing.
Tanks are programmed in Forf, a stack-based language similar to PostScript. Please read the Forf manual to learn more about forf, and the Tanks procedure reference for a description of Tanks extensions.
To get started, head over to the Tank Debugger and enter the following example tank. This tank will move around, turn the turret, and fire if there's something in front of it.
Sensor 0: 50 0 7 ☑ Sensor 1: 30 0 90 ☐ get-turret 12 + set-turret! ( Rotate turret ) 37 40 set-speed! ( Go in circles ) 0 sensor? { fire! } if ( Fire if turret sensor triggered ) 1 sensor? { -50 50 set-speed! } if ( Turn if collision sensor triggered )
Obviously, this tank could be improved. Studying the examples on this page should give you ideas about how to make a better tank. Don't forget the Forf manual and the Tank procedure reference.
Your PF-255 autonomous tank is built to the exacting specifications sent to our factory in New Khavistan. All distances are in meters, angles in degrees.