Bots and Simulations > The Gene depository

non-working conspec for advancedish sight system

(1/2) > >>

ashton15:
It's roughly a combination of Bubble, Occulus 2 and Beholder though the conspec doesn't quite work though as it turns to friendlies as well, any ideas?  

[div class=\'codetop\']CODE[div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']'''''''''''''''''''''''''''''
''''----____SIGHT____----''''


''''---- Genes 1-1 ----''''

''''----Setup Eye Positions And Sizes----''''
cond
*.robage 0 =
start
  342 .eye1dir store
  152 .eye2dir store
  62 .eye3dir store
  20 .eye4dir store
 -20 .eye6dir store
 -62 .eye7dir store
 -152 .eye8dir store
 -342 .eye9dir store

 260 .eye1width store
 120 .eye2width store
 60 .eye3width store
 25 .eye4width store
 15 .eye5width store
 25 .eye6width store
 60 .eye7width store
 120 .eye8width store
 260 .eye9width store
stop

''''---- Genes 2-2 ----''''

''''----When Finished Looking Reset Sight To Centre Of Vision----''''
cond
 *.focuseye 0 !=
start
 0 .focuseye store
stop

''''---- Genes 3-10 ----''''

''''----Look At Whatever Is Closest To Centre Of Vision----''''
cond
 *.eye5 0 =
 *.eye4 0 !=
 *.eye4 *.eye1 >=
 *.eye4 *.eye2 >=
 *.eye4 *.eye3 >=
 *.eye4 *.eye6 >=
 *.eye4 *.eye7 >=
 *.eye4 *.eye8 >=
 *.eye4 *.eye9 >=
start
 -1 .focuseye store
stop

cond
 *.eye5 0 =
 *.eye6 0 !=
 *.eye6 *.eye1 >
 *.eye6 *.eye2 >=
 *.eye6 *.eye3 >=
 *.eye6 *.eye4 >=
 *.eye6 *.eye7 >=
 *.eye6 *.eye8 >=
 *.eye6 *.eye9 >=
start
 1 .focuseye store
stop

cond
 *.eye5 0 =
 *.eye3 0 !=
 *.eye3 *.eye1 >
 *.eye3 *.eye2 >
 *.eye3 *.eye4 >=
 *.eye3 *.eye6 >=
 *.eye3 *.eye7 >=
 *.eye3 *.eye8 >=
 *.eye3 *.eye9 >=
start
 -2 .focuseye store
stop

cond
 *.eye5 0 =
 *.eye7 0 !=
 *.eye7 *.eye1 >
 *.eye7 *.eye2 >
 *.eye7 *.eye3 >
 *.eye7 *.eye4 >=
 *.eye7 *.eye6 >=
 *.eye7 *.eye8 >=
 *.eye7 *.eye9 >=
start
 2 .focuseye store
stop

cond
 *.eye5 0 =
 *.eye2 0 !=
 *.eye2 *.eye1 >
 *.eye2 *.eye3 >
 *.eye2 *.eye4 >
 *.eye2 *.eye6 >
 *.eye2 *.eye7 >=
 *.eye2 *.eye8 >=
 *.eye2 *.eye9 >=
start
 -3 .focuseye store
stop

cond
 *.eye5 0 =
 *.eye8 0 !=
 *.eye8 *.eye1 >
 *.eye8 *.eye2 >
 *.eye8 *.eye3 >
 *.eye8 *.eye4 >
 *.eye8 *.eye6 >
 *.eye8 *.eye7 >=
 *.eye8 *.eye9 >=
start
 3 .focuseye store
stop

cond
 *.eye5 0 =
 *.eye1 0 !=
 *.eye1 *.eye2 >
 *.eye1 *.eye3 >
 *.eye1 *.eye4 >
 *.eye1 *.eye6 >
 *.eye1 *.eye7 >
 *.eye1 *.eye8 >
 *.eye1 *.eye9 >=
start
 -4 .focuseye store
stop

cond
 *.eye5 0 =
 *.eye9 0 !=
 *.eye9 *.eye1 >
 *.eye9 *.eye2 >
 *.eye9 *.eye3 >
 *.eye9 *.eye4 >
 *.eye9 *.eye6 >
 *.eye9 *.eye7 >
 *.eye9 *.eye8 >
start
 4 .focuseye store
stop

'''''''''''''''''''''''''''''''
''''----____TURNING____----''''


''''---- Genes 11-18 ----''''

''''----Turn To Something You Are Looking At If It Is Not The Same Species As You----''''
cond
 *.focuseye -1 =
 *.refeye *.myeye !=
start
 *.aim 20 add .setaim store
stop

cond
 *.focuseye 1 =
 *.refeye *.myeye !=
start
 *.aim -20 add .setaim store
stop

cond
 *.focuseye -2 =
 *.refeye *.myeye !=
start
 *.aim 62 add .setaim store
stop

cond
 *.focuseye 2 =
 *.refeye *.myeye !=
start
 *.aim -62 add .setaim store
stop

cond
 *.focuseye -3 =
 *.refeye *.myeye !=
start
 *.aim 152 add .setaim store
stop

cond
 *.focuseye 3 =
 *.refeye *.myeye !=
start
 *.aim -152 add .setaim store
stop

cond
 *.focuseye -4 =
 *.refeye *.myeye !=
start
 *.aim 342 add .setaim store
stop

cond
 *.focuseye 4 =
 *.refeye *.myeye !=
start
 *.aim -342 add .setaim store
stop

ashton15:
Ah!  I worked it out, it seems to be because of the order of actions, my solution was to do a little something with the timer and, hey presto. Anyone who manages to make it work can use the code in thier bot as a prize.  

bacillus:
Personally, I'd avoid using built-in conspecs. Instead, use this:

cond
 *.robage 0 =
start
 X .out1 store    (X is any value other than zero)
stop

Two cells are conspecs if *.in1 *.out1 =

it's quite simple, really. put any value into your output (.in1 through to .in10), then compare your value to your output (.out1 to .out10, depending on where your output is). A similar method can be used with ties (.tinX/.outX). It's also more chameleon-proof, as you can set multiple conspecs, and also get one to generate a random number, then check if they don't match - you can generate a range from -32000 to 32000, so the probability of matching is one in 64000.

FINAL THOUGHT --> Always use *.refeye 0 != to make sure you're not staring into space.

ashton15:

--- Quote from: bacillus ---Personally, I'd avoid using built-in conspecs. Instead, use this:

cond
 *.robage 0 =
start
 X .out1 store    (X is any value other than zero)
stop

Two cells are conspecs if *.in1 *.out1 =

it's quite simple, really. put any value into your output (.in1 through to .in10), then compare your value to your output (.out1 to .out10, depending on where your output is). A similar method can be used with ties (.tinX/.outX). It's also more chameleon-proof, as you can set multiple conspecs, and also get one to generate a random number, then check if they don't match - you can generate a range from -32000 to 32000, so the probability of matching is one in 64000.

FINAL THOUGHT --> Always use *.refeye 0 != to make sure you're not staring into space.
--- End quote ---

I was going to do this in combination with memloc/memval though I checked the wiki and it says that .focuseye only works for refvars; as I normally need to conspec things not nescisarilly in front of me and so I figured using *.refeye *.myeye != would be better...  

If I could do it though it would work well  

bacillus:
The refeye reads everything concerning the other bot...

Navigation

[0] Message Index

[#] Next page

Go to full version