Darwinbots Forum
Welcome To Darwinbots => Newbie => Topic started by: Darwin226 on October 30, 2008, 04:53:26 PM
-
cond
*1 0 =
start
40 .aimdx store
1 1 store
stop
When I run the sim, this gene is always active. How can that be? In the condition it says to activate if 0 is stored in 1.
When it activates, 1 is stored to 1 but is still activates.
I think it's because location 1 is used by .up.
If that is the problem then can someone tell me which numbers can I use from my own memory?
-
Yes, 1 is in use and is one of the sysvars that recet every cycle (So you don't need to store 0 in up to stop accelerating).
Some sysvars are always 32000 in the case where storing 0 should cause an action. (You can check this by double clicking a bot and looking at it's memmory.)
And there is a range the dev team promissed not to mess with, I think it's like 50-175 or something like that (I usualy stay around the midle of that range).
Also on the sysvars page you can see all memmory locations, anything not in use is free (But may get reserved with later updates, whereas the above mentioned won't be used any time soon).
Also a good tip, used defines instead of magic tweek values, atleast for locations and constants that you'll be using in several places or plan to spend time tweeking.
For example :
'constants
def shotBoost 10
def conspecKey 56789
'variables
def keyLocation 110
def turned 111
start
*.robage 0 =
.conspecKey .keyLocation store
.keyLocation .memloc store
*.eye5 0 =
*.memval .conspecKey = or
*.turned 0 = and
40 .aimdx store
1 .turned store
*.eye5 0 !=
*.memval .conspecKey != and
-1 .shoot store
.shotBoost .shootval store
stop
-
Does that mean I can make my own variables with names?
Like instead of using 1 40 store I could use 1 .myveryownvar store.
-
yep. You use "def" at the start of your DNA. Something like this:
def myval 1 (or is it def 1 myval? I can never remember).
-
yep. You use "def" at the start of your DNA. Something like this:
def myval 1 (or is it def 1 myval? I can never remember).
You have it right; it is def myval ___
Moonfisher is also correct:
Memory locations between 50 and 175 are the traditionally used custom variables, and have been guaranteed not to be replaced with a sysvar in the future.
From Here (http://www.darwinbots.com/WikiManual/index.php?title=Free_Variables)