Author Topic: Hey  (Read 3897 times)

Offline ashton15

  • Bot Builder
  • **
  • Posts: 99
    • View Profile
Hey
« on: March 13, 2010, 01:16:54 PM »
Hey all  , I'm new and that's about all I have to say apart from here's my first bot:

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

'Turn to robot located in eye 4
cond
 *.eye5 0 =
 *.eye4 0 !=
 *.eye4 *.eye1 >=
 *.eye4 *.eye2 >=
 *.eye4 *.eye3 >=
 *.eye4 *.eye6 >=
 *.eye4 *.eye7 >=
 *.eye4 *.eye8 >=
 *.eye4 *.eye9 >=
start
 *.aim 35 add .setaim store
stop

'Turn to robot located in eye 6
cond
 *.eye5 0 =
 *.eye6 0 !=
 *.eye6 *.eye1 >
 *.eye6 *.eye2 >=
 *.eye6 *.eye3 >=
 *.eye6 *.eye4 >=
 *.eye6 *.eye7 >=
 *.eye6 *.eye8 >=
 *.eye6 *.eye9 >=
start
 *.aim -35 add .setaim store
stop

'Turn to robot located in eye 3
cond
 *.eye5 0 =
 *.eye3 0 !=
 *.eye3 *.eye1 >
 *.eye3 *.eye2 >
 *.eye3 *.eye4 >=
 *.eye3 *.eye6 >=
 *.eye3 *.eye7 >=
 *.eye3 *.eye8 >=
 *.eye3 *.eye9 >=
start
 *.aim 70 add .setaim store
stop

'Turn to robot located in eye 7
cond
 *.eye5 0 =
 *.eye7 0 !=
 *.eye7 *.eye1 >
 *.eye7 *.eye2 >
 *.eye7 *.eye3 >
 *.eye7 *.eye4 >=
 *.eye7 *.eye6 >=
 *.eye7 *.eye8 >=
 *.eye7 *.eye9 >=
start
 *.aim -70 add .setaim store
stop

'Turn to robot located in eye 2
cond
 *.eye5 0 =
 *.eye2 0 !=
 *.eye2 *.eye1 >
 *.eye2 *.eye3 >
 *.eye2 *.eye4 >
 *.eye2 *.eye6 >
 *.eye2 *.eye7 >=
 *.eye2 *.eye8 >=
 *.eye2 *.eye9 >=
start
 *.aim 105 add .setaim store
stop

'Turn to robot located in eye 8
cond
 *.eye5 0 =
 *.eye8 0 !=
 *.eye8 *.eye1 >
 *.eye8 *.eye2 >
 *.eye8 *.eye3 >
 *.eye8 *.eye4 >
 *.eye8 *.eye6 >
 *.eye8 *.eye7 >=
 *.eye8 *.eye9 >=
start
*.aim -105 add .setaim store
stop

'Turn to robot located in eye 1
cond
 *.eye5 0 =
 *.eye1 0 !=
 *.eye1 *.eye2 >
 *.eye1 *.eye3 >
 *.eye1 *.eye4 >
 *.eye1 *.eye6 >
 *.eye1 *.eye7 >
 *.eye1 *.eye8 >
 *.eye1 *.eye9 >=
start
 *.aim 140 add .setaim store
stop

'Turn to robot located in eye 9
cond
 *.eye5 0 =
 *.eye9 0 !=
 *.eye9 *.eye1 >
 *.eye9 *.eye2 >
 *.eye9 *.eye3 >
 *.eye9 *.eye4 >
 *.eye9 *.eye6 >
 *.eye9 *.eye7 >
 *.eye9 *.eye8 >
start
 *.aim -140 add .setaim store
stop

'Look arround if I can't see anything and I'm not being shot
cond
*.eye1 0 =
*.eye2 0 =
*.eye3 0 =
*.eye4 0 =
*.eye5 0 =
*.eye6 0 =
*.eye7 0 =
*.eye8 0 =
*.eye9 0 =
*.shflav 0 =
*.shflav -2 = or
start
*.aim 280 add .setaim store
stop

'When shot turn to attacker
cond
 *.shflav 0 !=
 *.shflav -2 !=
start
 1256 *.shang sub .setaim store
stop

'Approach anything you can see
cond
 *.eye5 0 !=
start
 *.refveldx .dx store
 *.refvelup 30 add .up store
stop

'*************
'Ties
'*************

'If something has more energy than me connect to it
cond
 *.refnrg *.nrg >
 *.refshoot 0 =
 *.refeye *.myeye !=
 *.eye5 60 >
start
 .tie inc
 *.robage 10 mod 0 =
 628 .aimdx store
 *.refvelup .up store
stop

'If I see another animeep that is close to me connect to it
cond
 *.eye5 60 >
 *.refeye *.myeye =
 *.timer 50 >
start
 *.refvelup .up store
 628 .aimdx store
 .tie inc
 *.refvelup .up store
stop

'Share energy equaly between things I'm connected to
cond
 *.numties 0 >
start
 50 .sharenrg *.multi mult store
 50 .sharewaste *.multi mult store
stop

'If I'm pulling strongly but not moving in the direction I want disconnect
cond
 *.eye5 30 <
 *.eye5 0 !=
 *.up 25 >
 *.velup 15 <
 *.numties 0 >
start
 .deltie inc
 .timer 0 store
stop

'If I'm connected to something that might attack me disconnect from it
cond
 *.trefshoot 0 !=
 *.trefeye *.myeye !=
start
 .deltie inc
stop

'If in pain, disconnect
cond
 *.pain 200 >
start
 .deltie inc
 .timer 0 store
stop


'*************
'Shooting
'*************

'If something has less energy than me, shoot it.
cond
 *.eye5 60 >
 *.refnrg *.nrg <
 *.refeye *.myeye !=
start
 .shoot dec
 *.refvelup .up store
stop

'If something might attack me shoot it
cond
 *.eye5 60 >
 *.refshoot 0 !=
 *.refeye *.myeye !=
start
 .shoot dec
 *.refvelup .up store
stop

'*************
'Reproduction
'*************

'Reproduce when connected to food and the meep is healthy
cond
 *.numties 0 >
 *.nrg 2500 >
 *.body 500 >
 *.pleas 50 >
start
 20 .repro store
stop

'*************
'Mantinence
'*************

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

'Grow
cond
 *.nrg 3000 >
start
 100 .strbody store
stop

'build shell
cond
 *.shell 250 <
start
 100 .mkshell store
stop

'define poison
cond
 *.robage 0 =
start
 .shoot .ploc store
stop

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

'delete viruses
cond
 *.mkvirus 0 !=
start
 *.mkvirus .delgene store
stop
end

So what do you think,  it doesn't rank on the F1 league at all but how would you improve it so it could?    

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Hey
« Reply #1 on: March 13, 2010, 03:09:13 PM »
Hi!
The F1 league is a very lofty goal-I'd aim for F3 first. This gets you a good base bot to work on, as you can't use tricks, so the system behind the bot has to be very robust. Next, try getting your defenses sorted out in F2, then you can go for F1 with some dramatic trick  

EDIT=> I see the first bit of your code is very similar to Commander Keen's Oculus Infinitus-you could have a look at OCULUS and OCULUS II in the gene depository-it's a store command that sets the focus eye to the closest target, then uses *.eyef to read it as if it were, for example, *.eye5 . You can then read data from off-side (it's now the focus eye, so can be read as though it were eye5) to decide whether to turn towards that bot or not by using *.refxpos *.refypos angle .setaim store. This prevens your bots from turning into conspecs.
« Last Edit: March 13, 2010, 03:13:53 PM by bacillus »
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan

Offline ashton15

  • Bot Builder
  • **
  • Posts: 99
    • View Profile
Hey
« Reply #2 on: March 13, 2010, 03:59:42 PM »
Quote from: bacillus
Hi!
The F1 league is a very lofty goal-I'd aim for F3 first. This gets you a good base bot to work on, as you can't use tricks, so the system behind the bot has to be very robust. Next, try getting your defenses sorted out in F2, then you can go for F1 with some dramatic trick  
I might try that... sounds like a good idea  

Quote from: bacillus
EDIT=> I see the first bit of your code is very similar to Commander Keen's Oculus Infinitus-you could have a look at OCULUS and OCULUS II in the gene depository-it's a store command that sets the focus eye to the closest target, then uses *.eyef to read it as if it were, for example, *.eye5 . You can then read data from off-side (it's now the focus eye, so can be read as though it were eye5) to decide whether to turn towards that bot or not by using *.refxpos *.refypos angle .setaim store. This prevens your bots from turning into conspecs.

Thanks for the refrence... I think you overestimate my abilities however , I'm not entirely sure what the majority of the code means . But thanks anyway.   Most of the eyesight genes is just code that i re-arranged from bubbles [/font]
« Last Edit: March 13, 2010, 04:02:08 PM by ashton15 »

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Hey
« Reply #3 on: March 13, 2010, 10:15:10 PM »
I never intended OCULUS to be understandable, and I don't think many have tried. If you take the time to learn conditionless logic and replicate its function (not saying that you should-it achieves the same thing as normal genes in a very messy, compact and cool-looking lob of code. And if you make a mistake, you have no hope of finding it. Trust me. Really.), you'll see it does exactly the same thing your code does, except changing the focus eye instead of turning straight away. Use this as a form of 'black box' code, but .eyef and .focuseye are worth reading up on the wiki.
« Last Edit: March 13, 2010, 10:16:49 PM by bacillus »
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan

Offline ashton15

  • Bot Builder
  • **
  • Posts: 99
    • View Profile
Hey
« Reply #4 on: March 14, 2010, 07:04:28 AM »
Well I've tried to add focus eye,   at the expense of an extra gene per eye,   what do you think, how would you change it?  for some reason the conspec doesn't work.

Code: [Select]
'''''''''''''''''''''''''''''
''''----____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

'and so on ror all the other eyes
« Last Edit: December 22, 2011, 11:56:33 AM by Shasta »

Offline ashton15

  • Bot Builder
  • **
  • Posts: 99
    • View Profile
Hey
« Reply #5 on: March 14, 2010, 03:38:35 PM »
nevermind, i worked it out... it's do do with the order of actions. I used a timer to make it work

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Hey
« Reply #6 on: March 15, 2010, 12:36:49 AM »
Congratulations, you just replicated OCULUS II in nine genes!    (Although I was using exactly those genes for months until I had a couple of days spare to compile it...)

You can use .setaim to directly set the angle: *.refxpos *.refypos angle .setaim store will aim for whatever is in the focus eye with dead accuracy (although you will need velocity compensation to adjust a notch or two). Use *.eyef 0 != as a condition to make sure you can actually see anything in your focus eye, otherwise you end up with wild and erratic behaviour.
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan