Author Topic: My first SG bot  (Read 3225 times)

Offline strangers

  • Bot Neophyte
  • *
  • Posts: 37
    • View Profile
My first SG bot
« on: July 23, 2007, 11:46:27 PM »
 
MOVED FARTHER DOWN THE LINE
Well first off I'd like to say, SG bots get complicated, fast. Apparently somethings is going wrong in the initialize gene and the search gene, so by extension it doesn't move or avoid conspecs. Originally this was supposed to be a SGized version of P. Gryphus, but once I get the kinks worked out this will be its own bot. Any help will be appreciated. Thanks in advance!
« Last Edit: August 10, 2007, 11:23:40 PM by strangers »

Offline Jez

  • Bot Overlord
  • ****
  • Posts: 788
    • View Profile
My first SG bot
« Reply #1 on: July 24, 2007, 12:31:09 PM »
Disclaimer: There are people a lot better qualified than me who will be able to give you a better and more accurate answer but...

At a glance you don't seem to have anything to only make your intialisation bit only work when the bot age is 1

I'm not sure, (may have changed now though) that the bot can see anything when it is first born.
If you try and take a cat apart to see how it works, the first thing you have in your hands is a non-working cat.
Douglas Adams

Offline strangers

  • Bot Neophyte
  • *
  • Posts: 37
    • View Profile
My first SG bot
« Reply #2 on: July 24, 2007, 12:53:21 PM »
Actually the initialize is just used to see if it sees anything and if it's a conspec then it stores either a 1 or 0 in 972 and references it in the search genes.
Edit: Oh yeah, I forgot to cut out the part that checked memval, that might help.
« Last Edit: July 24, 2007, 11:15:38 PM by strangers »

Offline strangers

  • Bot Neophyte
  • *
  • Posts: 37
    • View Profile
My first SG bot
« Reply #3 on: August 10, 2007, 11:27:39 PM »
Still in need of hel here... It avoids conspecs, but refuses to turn properly, also it can't even beat Martian Tank 2 in the leagues. Then I've another bot, it can beat M. Tank 2, but not 3. He could use some help with energy efficiency, actually both of them could.

Code: [Select]
'Proeliator Sphinx
'by Strangers
'


'Initialize
'**********
cond
start
*.refeye *.myeye sub dup div *.eye5 sgn mult 973 store
*.refeye *.myeye sub sgn abs 1 sub -1 mult *.eye5 sgn mult 972 store
200 rnd 55 0 *.robage sub sgn 0 floor mult store

'Spinning
'************
314 rnd .aimdx *.refeye *.myeye sub sgn abs 1 sub -1 mult *.eye5 sgn mult *.eye5 sgn 1 sub -1 mult add sgn abs mult

'Search
'*********
*.eye9 *.eye1 sub sgn 60 mult .aimdx store
*.eye2 *.eye8 sub sgn 50 mult .aimsx store
*.eye7 *.eye3 sub sgn 40 mult .aimdx store
*.eye4 *.eye6 sub sgn 30 mult .aimsx store


' Moving
'**********
*.refveldx .dx *973 mult store
*.refvelup 30 add .up *973 mult store

' Obtaining Food and Shooting
'***********************************
*.eye5 40 sub sgn 0 floor *.refeye *.myeye sub abs sgn mult 974 store
-6 .shoot *974 mult store
-32000 .shootval *974 mult store
*.refxpos *.refypos angle .setaim *974 mult store
*.refvelup 10 add .up *974 mult store
*.refveldx .dx *.eye5 0 sub sgn 0 floor *.refeye *.myeye sub abs sgn mult *.memval *.genes sub abs sgn mult mult store
*.body 100 div .shootval *.eye5 0 sub sgn 0 floor *.refeye *.myeye sub abs sgn mult *.memval *.genes sub abs sgn mult mult store

'Avoid conspecifics
'**********************
*.maxvel *.vel add *.eye5 mult 50 div 15 ceil .dn *972 mult store

'Reproduction
'****************
80 *.nrg 3000 sub sgn 1 sub sgn 1 add .repro mult store

'Tie Feeding
'****************
*55 .tie *.eye5 30 sub sgn 0 floor mult *.refeye *.myeye sub dup div mult store
*55 .readtie *.eye5 30 sub sgn 0 floor mult *.refeye *.myeye sub dup div mult store

-1 .tieloc *.numties 0 sub sqr dup div mult store
-1000 .tieval *.numties 0 sub sqr dup div mult store
*55 .tienum *.numties 0 sub sqr dup div mult store

*55 .deltie *.trefeye *.myeye sub dup div 1 sub abs mult store

*.tiepres .deltie *.tiepres *55 sub dup div mult store

*.tiepres .deltie *.tiepres *55 sub dup div 1 sub abs mult *.pain 900 sub sqr dup div mult mult store

99 .sharenrg *.multi 1 sub dup div 1 sub abs mult *.trefeye *.myeye sub dup div mult mult store
.sharewaste *.multi 1 sub dup div 1 sub abs mult *.trefeye *.myeye sub dup div mult mult inc

'Body Management
'**********************
100 .strbody *.nrg 2000 sub sgn 0 floor 10000 *.body sub sgn 0 floor mult mult store
100 .fdbody 200 *.nrg sub sgn 0 floor mult store

'Slime Management
'************************
500 *.slime sub .mkslime 500 *.slime sub sgn 0 floor *.nrg 5000 sub sgn 0 floor mult mult store

'Shell Management
'**********************
50 *.shell sub .mkshell 50 *.shell sub sgn 0 floor *.nrg 5000 sub sgn 0 floor mult mult store

'Waste Management
'*************************
1 .backshot *.waste 100 sub sgn 0 floor mult store
-4 .shoot *.waste 100 sub sgn 0 floor mult store
*.waste .shootval *.waste 100 sub sgn 0 floor mult store

'Anti Virus and Defense
'***************************
0 .shoot *.shoot -2 sub dup div 1 sub abs mult store

.fixpos *.fixpos 0 sub sqr dup div mult dec

.delgene inc
.delgene inc
stop

end


Second Bot:
'Proeliator Lycaon
'by Strangers
'


'Initialize
'*********
cond
*.robage 2 <
start
15 .up store
.tie *.robage 1 add mult inc
.deltie inc
500 rnd 55 store
7 989 store
stop

'Spinning
'**********
cond
*.eye5 0 =
start
mult 314 rnd
stop

'Search
'*********
cond
*.refeye *.myeye !=
*.refshoot *.myshoot !=
*.eye1 *.eye9 >
*.eye1 *.eye5 >
start
mult -140
stop

cond
*.refeye *.myeye !=
*.refshoot *.myshoot !=
*.eye9 *.eye1 >
*.eye9 *.eye5 >
start
mult 140
stop

cond
*.refeye *.myeye !=
*.refshoot *.myshoot !=
*.eye2 *.eye8 >
*.eye2 *.eye5 >
start
mult -105
stop

cond
*.refeye *.myeye !=
*.refshoot *.myshoot !=
*.eye8 *.eye2 >
*.eye8 *.eye5 >
start
mult 105
stop

cond
*.refeye *.myeye !=
*.refshoot *.myshoot !=
*.eye3 *.eye7 >
*.eye3 *.eye5 >
start
mult -70
stop

cond
*.refeye *.myeye !=
*.refshoot *.myshoot !=
*.eye7 *.eye3 >
*.eye7 *.eye5 >
start
mult 70
stop

cond
*.refeye *.myeye !=
*.refshoot *.myshoot !=
*.eye4 *.eye6 >
*.eye4 *.eye5 >
start
mult -35
stop

cond
*.refeye *.myeye !=
*.refshoot *.myshoot !=
*.eye6 *.eye4 >
*.eye6 *.eye5 >
start
mult 35
stop

'Moving
'*********
*.eye5 0 >
*.refeye *.myeye !=
*.refshoot *.myshoot !=
start
*.refvelup 30 add .up store
*.refveldx .dx store
stop

'Avoid conspecs
'******************
cond
*.refeye *.myeye =
*.refshoot *.myshoot =
start
*.maxvel *.vel add *.eye5 mult 50 div 15 ceil .dx store
stop

'Shooting
'**********
cond
*.eye5 45 >
*.refeye *.myeye !=
*.refshoot *.myshoot !=
*.refeye 0 !=
*.refpoison 0 >
start
*.refvelup .up store
*.refveldx .dx store
*.refxpos *.refypos angle .setaim store
-6 .shoot store
-32000 .shootval store
stop

cond
*.eye5 45 >
*.refeye *.myeye !=
*.refshoot *.myshoot !=
*.refeye 0 !=
*.refpoison 0 =
start
*.refvelup .up store
*.refveldx .dx store
*.refxpos *.refypos angle .setaim store
-1 .shoot store
-32000 .shootval store
stop

cond
*.eye5 45 >
*.refeye *.myeye !=
*.refshoot *.myshoot !=
*.refeye 0 =
start
*.refvelup .up store
*.refveldx .dx store
*.refxpos *.refypos angle .setaim store
-6 .shoot store
-32000 .shootval store
stop

cond
*.eye5 0 =
*.refeye *.myeye = or
*.refshoot 0 = or
*.shflav 0 !=
*.shflav -2 !=
start
942 *.shang sub .setaim store
0 .shflav store
stop

cond
*.shflav 0 !=
*.shflav -2 !=
start
*.shang .aimshoot store
32 .shootval store
-6 .shoot store
0 .shflav store
stop

cond
*.shoot -2 =
*.eye5 0 !=
*.refeye *.myeye !=
start
mult
500 .up store
mult 900 rnd 100 add
stop

cond
start
.aimdx store
stop

'Repro
'*******
cond
start
80 *.nrg 3000 sub sgn 1 sub sgn 1 add .repro mult store
stop

'Resources
'*************
cond
*.nrg 300 >
start
.mkshell inc
.strpoison inc
.strbody inc
stop

'Tie Feeding
'****************
cond
*.myshoot *.refshoot !=
*.eye5 30 >
*.refeye *.myeye !=
*.pain 900 <
start
*55 .tie store
*55 .readtie store
stop

cond
*.tiepres *55 =
*.pain 900 <
start
-1 .tieloc store
-1000 .tieval store
*55 .tienum store
stop

cond
*.tiepres *55 !=
*.tiepres 0 >
start
*.tiepres .tienum store
.tieval .tieloc store
1000 .tieval store
stop

cond
*.tiepres *55 =
*.pain 900 >
start
-1000 .tieval store
*.tieval 1000 div .tieloc store
stop

cond
*.trefeye *.myeye =
*.trefshoot *.myshoot =
start
*55 .deltie store
stop

cond
*.multi 1 =
*.trefeye *.myeye !=
*.trefshoot *.myshoot !=
start
99 .sharenrg store
.sharewaste inc
stop

'Waste
'*********
cond
*.waste 100 >
start
*.waste .shootval store
1 .backshot store
-4 .shoot store
stop



end
Any help is appreciated.

Offline abyaly

  • Bot Destroyer
  • ***
  • Posts: 363
    • View Profile
My first SG bot
« Reply #4 on: August 14, 2007, 10:04:41 PM »
Getting it to work the way you want it to is half the fun ^^
Lancre operated on the feudal system, which was to say, everyone feuded all
the time and handed on the fight to their descendants.
        -- (Terry Pratchett, Carpe Jugulum)