You may remember from the PopBeast handout that the bugs see a 5 by 7 rectangle. This is oriented as shown in figure 4.
Figure A bug's visual field.
In this diagram, the bug is facing upwards, or ``north''. It perceives
this rectangle as a two-dimensional ``retinal image''. Each location in
the retina represents one square, and contains a space if the square is
empty, or a symbol such as +
or *
if it isn't. With one
exception, this symbol is always the same as what you see on the screen.
The single exception is in the square containing the bug itself.
Although the screen display shows a B
, the bug does not see this;
as with the other squares, it sees either a space or an object symbol.
It's worth noting that within the retinal rectangle, a bug's vision
never gets blocked by objects near it: it can always see the contents of
every square.
A bug brain can access this retina by various sensory predicates,
such as can_see
and over
. These implement simple logical
tests on the visual field. For example,
can_see(+)is true if there is a
+
somewhere on the retina, and false
otherwise. Similarly,
can_see('1')would be true if the bug can see a
1
.
The predicate over
is a more specific test than can_see
.
It is true only if the bug is in the same square as the specified
object. Thus
over(+)is true if the bug is in the same square as a piece of food. This is a useful test, because you can only grab things that are in the same square as you.
The predicate holding
has nothing to do with the retina; it tests
what the bug is holding. Thus
holding(+)is true if the bug is holding a piece of food. It would be false if the bug is holding something else, or if its hand is empty.