No more trouble choosing constants
because YOU DONT HAVE TO !!!
this gene can "tune" any constant you want.
some examples are:
turning constants, shootval, up, repro (not recomended), and baisicaly any other constant.
This gene works by storing a value in ratial memory (the constant to be tuned),
Any child that the bot has will randomly inc or dec the constant,
the more successful child will have the most children and pass the more successful constant on (baisicaly, very controlled evolution)
Capable of producing realy finly tuned bots.
Here is the code (actualy consits of 2 genes)
first you can define the constant to a memory location,
it is nt nessicary but will make it more readable,
a RACTIAL memory location MUST be used ( 971 -990 )
def iset 972 'this is so the bot knows if it has already set an initial value, only the first bot will initiate the primary constant
def constant 971 'the "constant" can be replaced with anything you want, eg. shootvalue, aimright, moveup (note: must not be the same name as an existing memory name
Now you need to initiate the constant,
the first constant can be totaly random or a specific value
'initial random setup
cond
*.robage 0 =
*.iset 0 =
start
.iset inc
100 rnd .constant store
stop
'initial specified setup
cond
*.robage 0 =
*.iset 0 =
start
.iset inc
50 .constant store
stop
now the constant is inced or deced
note: this gene will only inc or dec the constant 50% of the time, this can be changed of course
'evo constant
cond
*.robage 0 =
start
'evo
1 rnd 970 add dup
1 rnd 0 =
inc
not
dec
dropbool
stop
And what you do now is instead of puting the actuale constant were you want it, you put the memory location of were it is stored
example:
instead of writing
20 .shootval store
you write
*.constant .shootval store
to see what the constant is, you simply view the bots memory location to which the constant is stored
The following is a mod af animal_minimalus
It changes shootval to find its optimum value in its location
once you found the optimum value, you can replace the constant in the bot you are developing with the one that the *.constant memory location holds
The following are to bots I developed,
First is a mod of Animal_minimalis that develops its shootval, the optimal constant I found for shootval was 32
The second is totaly original and capable of developing interesting swarming capabilities, note: this bot develops multiple constants
'evoless evo
'Animal_Adaptis
'seting vars
def iset 972
def shootvalue 971
'initial random setup
cond
*.robage 0 =
*.iset 0 =
start
.iset inc
100 rnd .shootvalue store
stop
'setup / evo
cond
*.robage 0 =
start
'evo
1 rnd 970 add dup
1 rnd 0 =
inc
not
dec
dropbool
stop
' Food Finder
cond
*.eye5 0 >
*.refeye *.myeye !=
start
*.refveldx .dx store
*.refvelup 30 add .up store
stop
' Eat Food
cond
*.robage 0 !=
*.eye5 50 >
*.refeye *.myeye !=
start
*.shootvalue .shootval store
-1 .shoot store
*.refvelup .up store
stop
' Avoiding Family
cond
*.eye5 0 =
*.refeye *.myeye = or
start
314 rnd .aimdx store
stop
' Reproduce
cond
*.nrg 20000 >
start
30 .repro store
stop
' Body
cond
*.body 1000 <
*.nrg 500 >
start
100 .strbody store
stop
end
'evoless evo
'Adaptive_preditor
'seting vars
def iset 971
def mconup 972
def mconsx 973
def mcondx 974
def scondi 975
'initial random setup
cond
*.robage 0 =
*.iset 0 =
start
.iset inc
100 rnd .mconup store
100 rnd .mconsx store
100 rnd .mcondx store
100 rnd .scondi store
stop
'setup / evo
cond
*.robage 0 =
start
'setting eyes
40 .eye5width store
60 .eye1width store
60 .eye9width store
'evo
5 rnd 970 add dup
1 rnd 0 =
inc
not
dec
dropbool
stop
'chasing food / feeding
cond
*.robage 0 >
*.eye5 0 >
*.refeye *.myeye !=
start
*.eye5 *.scondi >
-1 .shoot store
not
*.mconup .up store
dropbool
stop
'finding food
cond
*.eye1 *.eye9 add 0 =
*.eye5 0 =
*.refeye *.myeye = or and
*.robage 0 >
start
rnd *.mcondx *.mcondx add .aimdx store
stop
cond
*.eye1 *.eye9 >
*.eye5 0 =
*.refeye *.myeye = or and
*.robage 0 >
start
*.mconsx .aimsx store
*.mconup .up store
stop
cond
*.eye9 *.eye1 >
*.eye5 0 =
*.refeye *.myeye = or and
*.robage 0 >
start
*.mcondx .aimdx store
*.mconup .up store
stop
cond
*.scondi *.eyef <
*.refeye *.myeye =
*.robage 0 >
start
*.mconup .dn store
0 .up store
stop
'reprodicing
cond
*.nrg 3000 >
start
30 .repro store
stop