.reftype
What you are looking at: 0 if it is a bot and 1 if it is a shape (an obstacle of the scenario).
Facts
- Address
- 685
- Name
.reftype- Kind
- Sense: the engine writes it for the DNA to read
- Group
- What it sees (ref*)
- Written by
- The engine, in the actions phase of every cycle: 0 if your focus eye sees a bot, 1 if it sees a shape. In the forces and collisions phase, 1 if you collide with a shape while seeing nothing. You read it in the next cycle.
- Cleared
- The engine, every cycle, when the senses are cleared.
- Range
- 0 or 1; if you see nothing it is 0, unless you collide with a shape, which sets it to 1.
- Mutations
- picked as a read (
*)
.reftype says what kind of object your focus eye sees: 0 for a bot, 1 for a shape, the obstacles that can be placed in the scenario (if the simulation lets shapes be seen). When what you see is a shape, the rest of the ref* sysvars come in at 0 except position, velocity and .reffixed.
The catch is that 0 is also what it is when you see nothing. .reftype at 0 doesn't mean “there is a bot”: for that, combine it with an eye, such as .eye5 or .eyef.
There is one more case where it is 1: when you collide with a shape without seeing anything. That way a blind bot also finds out that it bumped into a wall.
' a wall ahead: I turn
cond
*.eye5 0 >
*.reftype 1 =
start
314 .aimdx store
stop