Neale Pickett
·
2024-12-05
intro.md
1---
2title: Tanks Introduction
3scripts:
4 - assets/js/tanks.js
5 - assets/js/figures.js
6---
7# Tanks Introduction
8
9<figure>
10 <canvas id="shortround"></canvas>
11 <figcaption>"ChashTank" dominates this short round.</figcaption>
12 <script type="text/javascript">
13 start("shortround", shortround);
14 </script>
15</figure>
16
17Tanks is a game in which you pit your coding abilities against
18other hackers. You write a program for your tank, set it out on
19the battlefield, and watch how it fares against other tanks while
20running your program.
21
22Each tank has a turret-mounted laser, two treads, up to ten
23sensors, and a diagnostic LED. Sensors are used to detect when
24other tanks are inside a given arc. In the examples on this page,
25"triggered" sensors turn black. Most tanks will take some action
26if a sensor is triggered, such as changing speed of the treads,
27turning the turret, or firing.
28
29Tanks are programmed in Forf, a stack-based language similar to
30PostScript. Please read the [Forf manual](forf.md) to learn more
31about forf, and the [Tanks procedure reference](procs.html) for a
32description of Tanks extensions.
33
34## Quick Start for the Impatient
35
36<figure>
37 <canvas id="default"></canvas>
38 <figcaption>"Crashmaster" pwns the lame default tank provided in this section.</figcaption>
39 <script type="text/javascript">
40 start("default", default_);
41 </script>
42</figure>
43
44To get started, head over to the designer for your game,
45and use the following example tank. This tank will
46move around, turn the turret, and fire if there's something in
47front of it.
48
49 Sensor 0: 50 0 7 ☑
50 Sensor 1: 30 0 90 ☐
51
52 get-turret 12 + set-turret! ( Rotate turret )
53 37 40 set-speed! ( Go in circles )
54 0 sensor? { fire! } if ( Fire if turret sensor triggered )
55 1 sensor? { -50 50 set-speed! } if ( Turn if collision sensor triggered )
56
57This tank can be improved!
58Watch other tanks in your game to get ideas about how to improve yours.
59Don't forget the [Forf manual](forf.md) and the
60[Tank procedure reference](procs.md).
61
62## Tank Specifications
63
64<figure>
65 <canvas id="antlion"></canvas>
66 <figcaption>"Ant Lion" nails "Rabbit With Gun".</figcaption>
67 <script type="text/javascript">
68 start("antlion", antlion);
69 </script>
70</figure>
71
72Your PF-255 autonomous tank is built to the exacting
73specifications sent to our factory in New Khavistan. All
74distances are in meters, angles in degrees.
75
76
77Tank size
78: The targettable area of the tank—the part which can be hit by a cannon—is a circle about 7½ meters in radius.
79
80Speed
81: Each tread can have a speed between -100 and 100. This is in
82 percentage of total speed for that tread, where total speed is
83 roughly 7 meters per turn.
84
85Sensors
86: Each sensor has a maximum range of 100 meters. Of course, you
87 don't have to use the full range. Sensors may be attached to
88 the turret (they turn along with the turret), or left fixed to
89 the tank.
90
91Turret
92: Turret angle can be set between -359° and 359°, with 0° directly
93 in front of the tank. Be aware that it takes time for the
94 turret to swing around: the turret can swing about 45° per turn.
95
96Cannon range and recharging
97: When the cannon is fired, it obliterates everything for 50
98 meters in front of it. It takes around 20 turns for your cannon
99 to recharge after it's been fired, so only shoot when you feel
100 like you're going to hit something.
101
102Good luck blowing everybody up!