DarwinBotsManual
Open the app EspañolES

.memval

The contents of a cell of the memory of the bot you are looking at; you choose the cell with .memloc.

Facts

Address
473
Name
.memval
Kind
Sense: the engine writes it for the DNA to read
Group
Memory (memloc, memval and genetic)
Written by
The engine copies cell .memloc of the bot you see, in the actions phase; and of the bot you collide with, in the forces and collisions phase. You read it in the next cycle.
Cleared
The engine, every cycle, when the senses are cleared.
Range
Whatever the spied cell holds: −32000 to 32000. It is 0 if you don't see a bot.
Mutations
picked as a read (*)

If you put an address between 1 and 1000 in .memloc, .memval brings what that cell holds in the memory of the bot you are looking at: the same bot whose data reaches the ref* sysvars, like .refnrg or .refage. It is also filled when you collide with another bot.

It is a sense like the eyes: the engine writes it after your DNA, you read it in the next cycle and it clears itself. It is 0 when you see no bot, when what you see is an obstacle, and also when the spied cell is 0, so it is a good idea to combine it with .eye5 or another sign that someone is in front of you.

' Spy on cell 61 of the bot I see
cond
start
61 .memloc store
stop

' If its cell 61 is 7 (my species' password), cell 50 is 1
cond
*.eye5 0 >
*.memval 7 =
start
1 50 store
stop

The most common use is recognizing species, by comparing with .dnalen or with a password saved in a cell of your own (see Memory (memloc, memval and genetic)). To spy on the bot you are tied to, the equivalent pair is .tmemloc and .tmemval.