It was brought to my attention after finishing this submission that the screen dumps on this page reflected an earlier version of Altaira than that described in the submission. They were replaced with the dumps shown here on June 19. The original line-following description, with the original screen dumps, is also available.

Following a Line

As a first example of using Altaira, we will use reflex-level rules to follow a line without making a map. For this task, we consider only the three center sensors; the tile marks detected by the outboard sensors are irrelevant. As this example requires only reflex-level rules, there will be no changes in direction or state in the course of the example.

All of the rules shown here are screen dumps taken from an Altaira session.

No Correction Required

No course correction is required when the only relevant sensor over a line is the center sensor. In this case, both motors are turned on, forward. Since either or both outboard sensors may also be on, we require the following four rules:

Veering to the Side

This situation can be detected if either the left or the right inboard sensor is dark (the center sensor may be either light or dark; a light center sensor indicates that the car has veered farther than a dark sensor). In all cases, we turn off the motor on the side with the dark inboard sensor. To save space, we will only show the rules for which the outboard sensors are light (keep in mind that rules are also required for the cases in which one or both outboard sensors are dark).

Default Rules

Two situations are not covered by the rules described so far: a situation in which the sensors are not over a line (this may well be a case in which the line is between the sensors), and the situation in which all three center sensors are dark (this will occur while the car is crossing the mark between two tiles, and as a result of the center line branching in the 3-way and 4-way intersection tiles). One likely thing to do in these cases is to simply leave both motors on, under the theory that simply plunging on is as useful a thing to do as any:

Intersections

The ruleset described here is available as line.rs. It will successfully follow simple lines, but will lose its way when entering a three-way intersection from the bottom. An alternate ruleset, which will turn right at intersections (and not get lost), may be obtained by changing the ``all-white'' default rules to:

Remember, the analogous states with dark outboard sensors are also required.