tanks

Blow up enemy tanks using code
git clone https://git.woozle.org/neale/tanks.git

tanks / docs
Neale Pickett  ·  2024-12-05

running.md

 1---
 2title: Running Tanks
 3---
 4
 5Unfortunately, it's kind of a mess right now.
 6I know there are a few forks of this code,
 7and I would love it if someone proposed a merge to clearly illustrate how to run tanks.
 8
 9When I spin up a new tanks game,
10typically I run something like:
11
12    while sleep 60; do ./run-tanks */; done
13
14This assumes all your tanks directories are in the same place as `run-tanks`.
15
16
17
18Included programs
19-----------------
20
21I tried to stick with the Unix philosophy of one program per task.  I
22also tried to avoid doing any string processing in C.  The result is a
23hodgepodge of C, Bourne shell, and awk, but at least each piece is
24fairly simple to audit.
25
26
27### run-tanks tank1 tank2 ...
28
29Runs a single round, awards points with rank.awk, and creates a new
30summary.html with summary.awk.  This is the main interface that you want
31to run from cron or whatever.
32      
33
34### forftanks tank1 tank2 ...
35
36A program to run a round of tanks and output a JSON description of the
37game.  This is what tanks.js uses to render a game graphically.
38The object printed contains:
39
40    [[game-width, game-height],
41     [[tank1-color, 
42      [[sensor1range, sensor1angle, sensor1width, sensor1turret],
43       ...]],
44      ...],
45     [[
46      [tank1x, tank1y, tank1angle, tank1sensangle, 
47       tank1flags, tank1sensors],
48      ...],
49     ...]]
50
51If file descriptor 3 is open for writes, it also outputs the results of
52the round to fd3.  
53
54
55### rank.awk
56
57Processes the fd3 output of forftanks to award points and output an
58HTML results table.
59
60
61### summary.awk tank1 tank2
62
63Creates summary.html, linking to all rounds and showing overall
64standing.
65
66
67### designer.cgi
68
69Accepts form input and writes a tank.
70
71
72
73