Darwinbots Forum
Welcome To Darwinbots => Newbie => Topic started by: HazD on April 13, 2006, 12:30:12 PM
-
Can someone give me code for recognising enemies mine don't seem to work. please?
-
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 (http://www.darwinbots.com/WikiManual/index.php?title=Conspec_recognition).
-
What have you tried using so far?
-
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
-
OK, this is my first experiment with bots and stuff learnt from the wiki and based on animal minimalis.
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
-
Which version are you using HazD?
Here's the corrected version. I've added an antibirthtie gene at the beginning, coding to make the venom work, corrected conspec recognition, and some prey-tracking routines, and some minor stuff
Your conspec routine for enemies should be *.refeye *.myeye != rather than *.refeye *.myeye =
' HazD's Bot
def venomcounter 51
' Birthtie begone!
cond
*.robage 2 <
start
.tie *.robage -1 mult 1 add mult inc
.deltie inc
stop
cond
*.robage 0 =
start
.shoot .ploc store
.mkshell .vloc store
-32000 .venval store
stop
cond
*.eye5 0 >
*.eye5 50 <
*.myeye *.refeye !=
start
*.refveldx .dx store
*.refvelup 50 add .up store
stop
cond
*.eye5 50 >
*.refeye *.myeye !=
start
-6 .shoot store
*.refveldx .dx store
*.refvelup .up store
stop
' Got shell? Use venom to remove it
cond
*.eye5 30 >
*.refshell 0 >
*.refeye *.myeye !=
start
.venomcounter inc
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 4000 >
start
40 .repro store
stop
end
-
I am using version 2.41.0 and thanks for correcting my first bot type thing.