TclRobots, written by Tom Poindexter, is a test of programming prowess. The goal is to program a robot that battles other robots and hopefully, survives to become the victor. How well a robot performs depends mostly on the Robot Control Program (RCP) you write. As in real life, there is randomness built into the contest, so even the best RCP is occasionally defeated.
The TclRobots arena is a square, 1,000 meters on each side. Robots, identical other than their controlling RCPs, have drive mechanisms that move them each in a given direction at a given velocity within the arena, scanners for seeking out enemy robots, and cannons for firing at the enemy. A contest involves two, three, or four robots, each trying to outlast the others. In Figure 20-4, two robot scanners have targeted enemies, complex.tr has taken a severe hit, and a cannon shot is in mid-flight.
Figure 20-4. A TclRobots contest
starts a robot instance by
execing a new wish
interpreter, then uses
send to customize it. First,
it transmits specially crafted subroutines that implement the RCP
command set (commands such as
commands define the RCP application programming interface (API), and
send to invoke subroutines in
tclrobots. Next, tclrobots
sends the Tcl RCP source code to the robot and starts it running.
(There’s actually a lot more detail behind the ...