TclRobots
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
tclrobots
starts a robot instance by
execing a new wish
interpreter,[3] then uses send to customize it. First,
it transmits specially crafted subroutines that implement the RCP
command set (commands such as drive,
scan, and cannon). These
commands define the RCP application programming interface (API), and
they use 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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access