Welcome To Darwinbots > Newbie

Stupid question

(1/2) > >>

HazD:
Can someone give me code for recognising enemies mine don't seem to work. please?

Numsgil:
The simplest and classical solution is to use the refvars.
 
 A conspec would have
 
 *.myeye *.refeye =
 
 While an enemy would have
 
 *.myeye *.refeye !=
 
 Other methods are briefly considered on The WIki.

PurpleYouko:
What have you tried using so far?

Elite:
Do you have the code for your bot so far? If you do showing us would help

As Num said, *.refeye/*.myeye conspec recognition is the most popular (and very secure)

Here's a shooting gene with *.refeye/*.myeye conspec recognition:

cond
*.eye5 40 >
*.refeye *.myeye !=
start
-1 .shoot store
stop

It will cause your bot to -1 shoot at bots that don't match its *.myeye

*******

Num's Ymir uses *.memloc/*.memval conspec recognition

So you add this gene to the start of your bot:

(BTW, you can use any other number in place of 123, and you can use any free memory location in place of 52)

cond
*.robage 0 =
start
123 52 store
52 .memloc store
stop

And then check *.memval

cond
*.eye5 40 >
*.memval 123 !=
start
-1 .shoot store
stop

HazD:
OK, this is my first experiment with bots and stuff learnt from the wiki and based on animal minimalis.

--- Code: ---def venomcounter 51

cond
 *.robage 0 =
start
 .shoot .ploc store
 .mkshell .vloc store
 -32000 .venval store
stop

cond
*.eye5 0 >
*.myeye *.refeye =
start
*.refveldx .dx store
*.refvelup .up store
stop

cond
*.eye5 50 >
*.refeye *.myeye =
start
-6 .shoot store
stop


cond
*.waste 40 >
start
.backshot inc
-4 .shoot store
*.waste .shootval store
stop

cond
 *.venomcounter 19 >
start
 50 .shootval store
 -3 .shoot store
 0 .venomcounter store
stop

cond
*.eye5 0 =
*.refeye *.myeye = or
start
314 rnd .aimdx store
stop


cond
 *.poison 500 <
start
 50 .strpoison store
stop

cond
 *.venom 500 <
start
 50 .strvenom store
stop

cond
 *.nrg 20000 >
start
 10 .repro store
stop
end
--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version