.focuseye
Chooses which of the nine eyes has the focus: the one copied into .eyef and the one that decides what the ref* cells describe.
Facts
- Address
- 511
- Name
.focuseye- Kind
- Command: the bot writes it and the engine reads it and usually consumes it
- Group
- Eyes
- Written by
- Your DNA.
- Read by
- The engine, in the actions phase of every cycle, when it fills
.eyefand the cells of what it sees. - Cleared
- Never: it stays as you left it.
- Range
- −32000 to 32000; the useful range is −4 to 4, and 0 is
.eye5. - Mutations
- picked as a store target
A number that chooses the focus eye. At 0 the focus is .eye5; each unit moves the focus one eye to the right and each negative unit one eye to the left:
Outside that range it does not raise an error, but the arithmetic is odd: the engine adds 4, drops the sign and keeps the remainder of dividing by 9. So 5 goes back to .eye1, and −5 gives .eye2, the same as −3. It is better to stay between −4 and 4.
The focus eye does two things. Its value is copied into .eyef, and the closest thing it sees is what the cells of what it sees describe (.refeye, .refnrg, .refxpos…). If the focus eye sees nothing, those cells stay at 0 even if another eye is seeing something (unless the bot is colliding with another: a collision fills them too).
It is configuration: the engine reads it but never clears it, so writing it once is enough. This bot puts the focus on the left eye and saves in cell 50 the energy of what that eye sees:
cond
*.robage 0 =
start
-4 .focuseye store
stop
cond
*.eyef 0 >
start
*.refnrg 50 store
stop