Author Topic: My first (functional... well sort of) bot (F3)  (Read 3767 times)

Offline d-EVO

  • Bot Destroyer
  • ***
  • Posts: 125
    • View Profile
My first (functional... well sort of) bot (F3)
« on: October 24, 2008, 07:17:58 PM »
this is my first bot. it is an F3 league bot ( I think ) and when I tested it it beat Purple Flamma so it is at least in the top thirty.

Obviosly because it is my first it has many rough edges and problems.
It has a targetting system that employs 9 simpleish genes that cause it to lock onto the nearest target. over kill, I know.
Only problem is it locks onto friendlies as well so they just stare at each other untill an enemy bot comes between them.
it uses a clever tactic which is to push the veges around at high speed causing the opponent to starve.
I calculated the exact unit the bot must turn from any eye to eye 5.

If someone could tell me how each eye can recognise friends ( or foes ) post the code here.
Rate it could do much better and at least beat BOTbot. it does if it has a good start.

tell me what you think. and any advice?
Code: [Select]
'My DNA code for an F3 Bot
'name : Alpha
'created by : d-EV0
'class : F3



' TARGETTING ENEMY


cond
 *.eye1 *.eye2 >=
 *.eye1 *.eye3 >=
 *.eye1 *.eye4 >=
 *.eye1 *.eye5 >=
 *.eye1 *.eye6 >=
 *.eye1 *.eye7 >=
 *.eye1 *.eye8 >=
 *.eye1 *.eye9 >=
 *.eye1 0 >
 *.refeye *.myeye !=
start
 140
 .aimsx
 store
stop

cond
 *.eye2 *.eye1 >=
 *.eye2 *.eye3 >=
 *.eye2 *.eye4 >=
 *.eye2 *.eye5 >=
 *.eye2 *.eye6 >=
 *.eye2 *.eye7 >=
 *.eye2 *.eye8 >=
 *.eye2 *.eye9 >=
 *.eye2 0 >
 *.refeye *.myeye !=
start
 105
 .aimsx
 store
stop

cond
 *.eye3 *.eye2 >=
 *.eye3 *.eye1 >=
 *.eye3 *.eye4 >=
 *.eye3 *.eye5 >=
 *.eye3 *.eye6 >=
 *.eye3 *.eye7 >=
 *.eye3 *.eye8 >=
 *.eye3 *.eye9 >=
 *.eye3 0 >
 *.refeye *.myeye !=
start
 70
 .aimsx
 store
stop

cond
 *.eye4 *.eye2 >=
 *.eye4 *.eye3 >=
 *.eye4 *.eye1 >=
 *.eye4 *.eye5 >=
 *.eye4 *.eye6 >=
 *.eye4 *.eye7 >=
 *.eye4 *.eye8 >=
 *.eye4 *.eye9 >=
 *.eye4 0 >
 *.refeye *.myeye !=
start
 35
 .aimsx
 store
stop

cond
 *.eye5 *.eye2 >=
 *.eye5 *.eye3 >=
 *.eye5 *.eye4 >=
 *.eye5 *.eye5 >=
 *.eye5 *.eye6 >=
 *.eye5 *.eye7 >=
 *.eye5 *.eye8 >=
 *.eye5 *.eye9 >=
 *.eye5 0 >
 *.refeye *.myeye !=
start
 1180 *.eye5 sub
 .up
 store
 20
 .dn
 store
 -6
 .shoot
 store
stop

cond
 *.eye6 *.eye2 >=
 *.eye6 *.eye3 >=
 *.eye6 *.eye4 >=
 *.eye6 *.eye5 >=
 *.eye6 *.eye1 >=
 *.eye6 *.eye7 >=
 *.eye6 *.eye8 >=
 *.eye6 *.eye9 >=
 *.eye6 0 >
 *.myeye *.refeye !=
start
 35
 .aimdx
 store
stop

cond
 *.eye7 *.eye2 >=
 *.eye7 *.eye3 >=
 *.eye7 *.eye4 >=
 *.eye7 *.eye5 >=
 *.eye7 *.eye6 >=
 *.eye7 *.eye1 >=
 *.eye7 *.eye8 >=
 *.eye7 *.eye9 >=
 *.eye7 0 >
 *.refeye *.myeye !=
start
 70
 .aimdx
 store
stop

cond
 *.eye8 *.eye2 >=
 *.eye8 *.eye3 >=
 *.eye8 *.eye4 >=
 *.eye8 *.eye5 >=
 *.eye8 *.eye6 >=
 *.eye8 *.eye7 >=
 *.eye8 *.eye1 >=
 *.eye8 *.eye9 >=
 *.eye8 0 >
 *.refeye *.myeye !=
start
 105
 .aimdx
 store
stop

cond
 *.eye9 *.eye2 >=
 *.eye9 *.eye3 >=
 *.eye9 *.eye4 >=
 *.eye9 *.eye5 >=
 *.eye9 *.eye6 >=
 *.eye9 *.eye7 >=
 *.eye9 *.eye8 >=
 *.eye9 *.eye1 >=
 *.eye9 0 >
 *.refeye *.myeye !=
start
 140
 .aimdx
 store

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

cond
 *.eye1 0 =
 *.eye2 0 =
 *.eye3 0 =
 *.eye4 0 =
 *.eye5 0 =
 *.eye6 0 =
 *.eye7 0 =
 *.eye8 0 =
 *.eye9 0 =
 *.val 5 <
start
 10
 .up
 store
 35
 .aimdx
 store
stop

cond
 *.nrg 10000 >
start
 33
 .repro
 store
stop

end
« Last Edit: October 24, 2008, 07:21:05 PM by d-EVO »
1:      2 is true
2:      1 is false

Offline Endy

  • Bot Overlord
  • ****
  • Posts: 852
    • View Profile
My first (functional... well sort of) bot
« Reply #1 on: October 24, 2008, 08:32:47 PM »
Only the focus eye can read back refvars, it defaults to eye5.

Need to remove:

*.refeye *.myeye !=

from the conditions except for the shooting gene. Right now the bots are only turning if they see a non-friend in eye5.

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
My first (functional... well sort of) bot
« Reply #2 on: October 25, 2008, 07:52:57 PM »
Quote from: d-EVO
Code: [Select]
cond
 *.eye1 *.eye2 >=
 *.eye1 *.eye3 >=
 *.eye1 *.eye4 >=
 *.eye1 *.eye5 >=
 *.eye1 *.eye6 >=
 *.eye1 *.eye7 >=
 *.eye1 *.eye8 >=
 *.eye1 *.eye9 >=
 *.eye1 0 >
 *.refeye *.myeye !=
start
 140
 .aimsx
 store
stop

cond
 *.eye2 *.eye1 >=
 *.eye2 *.eye3 >=
 *.eye2 *.eye4 >=
 *.eye2 *.eye5 >=
 *.eye2 *.eye6 >=
 *.eye2 *.eye7 >=
 *.eye2 *.eye8 >=
 *.eye2 *.eye9 >=
 *.eye2 0 >
 *.refeye *.myeye !=
start
 105
 .aimsx
 store
stop

cond
 *.eye3 *.eye2 >=
 *.eye3 *.eye1 >=
 *.eye3 *.eye4 >=
 *.eye3 *.eye5 >=
 *.eye3 *.eye6 >=
 *.eye3 *.eye7 >=
 *.eye3 *.eye8 >=
 *.eye3 *.eye9 >=
 *.eye3 0 >
 *.refeye *.myeye !=
start
 70
 .aimsx
 store
stop

cond
 *.eye4 *.eye2 >=
 *.eye4 *.eye3 >=
 *.eye4 *.eye1 >=
 *.eye4 *.eye5 >=
 *.eye4 *.eye6 >=
 *.eye4 *.eye7 >=
 *.eye4 *.eye8 >=
 *.eye4 *.eye9 >=
 *.eye4 0 >
 *.refeye *.myeye !=
start
 35
 .aimsx
 store
stop

cond
 *.eye6 *.eye2 >=
 *.eye6 *.eye3 >=
 *.eye6 *.eye4 >=
 *.eye6 *.eye5 >=
 *.eye6 *.eye1 >=
 *.eye6 *.eye7 >=
 *.eye6 *.eye8 >=
 *.eye6 *.eye9 >=
 *.eye6 0 >
 *.myeye *.refeye !=
start
 35
 .aimdx
 store
stop

cond
 *.eye7 *.eye2 >=
 *.eye7 *.eye3 >=
 *.eye7 *.eye4 >=
 *.eye7 *.eye5 >=
 *.eye7 *.eye6 >=
 *.eye7 *.eye1 >=
 *.eye7 *.eye8 >=
 *.eye7 *.eye9 >=
 *.eye7 0 >
 *.refeye *.myeye !=
start
 70
 .aimdx
 store
stop

cond
 *.eye8 *.eye2 >=
 *.eye8 *.eye3 >=
 *.eye8 *.eye4 >=
 *.eye8 *.eye5 >=
 *.eye8 *.eye6 >=
 *.eye8 *.eye7 >=
 *.eye8 *.eye1 >=
 *.eye8 *.eye9 >=
 *.eye8 0 >
 *.refeye *.myeye !=
start
 105
 .aimdx
 store
stop

cond
 *.eye9 *.eye2 >=
 *.eye9 *.eye3 >=
 *.eye9 *.eye4 >=
 *.eye9 *.eye5 >=
 *.eye9 *.eye6 >=
 *.eye9 *.eye7 >=
 *.eye9 *.eye8 >=
 *.eye9 *.eye1 >=
 *.eye9 0 >
 *.refeye *.myeye !=
start
 140
 .aimdx
 store
end

Try replacing this with the following code:

Code: [Select]
start
  -4 *.eye1 *.eye9 sub sgn 0 floor mult *.eye1 *.eye8 sub sgn 0 floor mult *.eye1 *.eye7 sub sgn 0    floor mult *.eye1 *.eye6 sub sgn 0 floor mult *.eye1 *.eye5 sub sgn 0 floor mult *.eye1 *.eye4 sub   sgn 0 floor mult *.eye1 *.eye3 sub sgn 0 floor mult *.eye1 *.eye2 sub sgn 0 floor mult 4 *.eye9     *.eye8 sub sgn 0 floor mult *.eye9 *.eye7 sub sgn 0 floor mult *.eye9 *.eye6 sub sgn 0 floor mult
 *.eye9 *.eye5 sub sgn 0 floor mult *.eye9 *.eye4 sub sgn 0 floor mult *.eye9 *.eye3 sub sgn 0 floor  mult *.eye9 *.eye2 sub sgn 0 floor mult *.eye9 *.eye1 sub sgn ++ sgn mult add -3 *.eye2 *.eye9 sub   sgn ++ sgn mult *.eye2 *.eye8 sub sgn 0 floor mult *.eye2 *.eye7 sub sgn 0 floor mult *.eye2 *.eye6  sub sgn 0 floor mult *.eye2 *.eye5 sub sgn 0 floor mult *.eye2 *.eye4 sub sgn 0 floor mult *.eye2    *.eye3 sub sgn 0 floor mult *.eye2 *.eye1 sub sgn ++ sgn mult add 3 *.eye8 *.eye9 sub sgn ++ sgn     mult *.eye8 *.eye7 sub sgn 0 floor mult *.eye8 *.eye6 sub sgn 0 floor mult *.eye8 *.eye5 sub sgn 0   floor mult *.eye8 *.eye4 sub sgn 0 floor mult *.eye8 *.eye3 sub sgn 0 floor mult *.eye8 *.eye2 sub   sgn ++ sgn mult *.eye8 *.eye1 sub sgn ++ sgn mult add -2 *.eye3 *.eye9 sub sgn ++ sgn mult *.eye3    *.eye8 sub sgn ++ sgn mult *.eye3 *.eye7 sub sgn 0 floor mult *.eye3 *.eye6 sub sgn 0 floor mult
 *.eye3 *.eye5 sub sgn 0 floor mult *.eye3 *.eye4 sub sgn 0 floor mult *.eye3 *.eye2 sub sgn ++ sgn   mult *.eye3 *.eye1 sub sgn ++ sgn mult add 2 *.eye7 *.eye9 sub sgn ++ sgn mult *.eye7 *.eye8 sub     sgn ++ sgn mult *.eye7 *.eye7 sub sgn 0 floor mult *.eye7 *.eye6 sub sgn 0 floor mult *.eye7 *.eye5  sub sgn 0 floor mult *.eye7 *.eye4 sub sgn ++ sgn mult *.eye7 *.eye2 sub sgn ++ sgn mult *.eye7     *.eye1 sub sgn ++ sgn mult add -1 *.eye4 *.eye9 sub sgn ++ sgn mult *.eye4 *.eye8 sub sgn ++ sgn mult *.eye4 *.eye7 sub sgn ++ sgn mult *.eye4 *.eye6 sub sgn 0 floor mult *.eye4 *.eye5 sub sgn 0    floor mult *.eye4 *.eye3 sub sgn ++ sgn mult *.eye4 *.eye2 sub sgn ++ sgn mult *.eye4 *.eye1 sub     sgn ++ sgn mult add 1 *.eye4 *.eye9 sub sgn ++ sgn mult *.eye4 *.eye8 sub sgn ++ sgn mult *.eye4    *.eye7 sub sgn ++ sgn mult *.eye4 *.eye6 sub sgn ++ sgn mult *.eye4 *.eye5 sub sgn 0 floor mult
 *.eye4 *.eye3 sub sgn ++ sgn mult *.eye4 *.eye2 sub sgn ++ sgn mult *.eye4 *.eye1 sub sgn ++ sgn     mult add 0 *.eye5 *.eye9 sub sgn ++ sgn mult *.eye5 *.eye8 sub sgn ++ sgn mult *.eye5 *.eye7 sub     sgn ++ sgn mult *.eye5 *.eye6 sub sgn ++ sgn mult *.eye5 *.eye4 sub sgn ++ sgn mult *.eye5 *.eye3   sub sgn ++ sgn mult *.eye5 *.eye2 sub sgn ++ sgn mult *.eye5 *.eye1 sub sgn ++ sgn mult add .focuseye store
stop

cond
 *.refeye *.myeye !=
 *.eyef 0 >
start
 *.refxpos *.refypos angle .setaim store
stop

Basically, that unreadable chunk of code sets .focuseye to the nearest bot, then the second gene reads whether the bot should turn towards it (ignores conspecs; note the extra condition *.eyef 0 >, as a blank eye will return 0 to refeye, and you may get some strange movement.) This way, you can get around that drawback with not being able to recognize conspecs out of the corner of your vision, as well as reading additional info about the bot.
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan