Bots and Simulations > Untagged bots
Slam Funk 1.0
Shasta:
--- Quote from: Ta-183 ---I got a chance to run a version of Slam Funk 2 a few minutes ago. It didn't work nearly at all. Only the genes retained from Slam funk 1.X seemed to work. I think I narrowed the problem down to my use of custom constants. Now, in the code above, I tried to define constants using 'def constant 2' for example. Now what I thought I was doing was setting .constant to 2. But I think what it really did was set .constant to MEMORY LOCATION 2. Is this accurate?
--- End quote ---
Yes it is, if you want a memory value to always be the same, what you could do is place a gene/block at the very end and set them all there. But if you are trying to use them for math, find and replace is your friend.
Ta-183:
Im using them as constants so I can do logical checks. like for example seeing if *.health is equal to *.dying. This way it's easy to put interrupts into my genes so it can decide whether or not to do something. This is going to take a major modification of my current code, but only so far as to add a few dozen lines for constant initialization. The system isn't half bad if I do say so myself. It's just the constants than need work.
EDIT: Arrg, now it's deleting it's genes whenever it reproduces!!
Okay. I'm posting the code now, somebody PLEASE tell me what's going wrong here!
--- Code: ---'Slam Funk 2.0 (Release Candidate 2)
'Second Generation of Slam Funk
'Vastly improved communication and decision making.
'Can now differentiate between enemy and food
'And effectively relay information.
'Has improved diagnostics routines and retreat capability.
'CHANGELOG
'Ver 2.00
' Initial Build
'
'Communication
def txpos 50
def typos 51
'Identification Friend Foe or Food
def IFFF 52
def notarget 53
def friend 54
def food 55
def foe 56
'Secure Conspec Constants
def algaminimalis 57
'Situational Awareness
def situation 58
def nothing 59
def eating 60
def fighting 61
'Condition
def health 62
def fine 63
def injured 64
def dying 65
def intox 66
'-------- CONSTANT INITIALIZATION --------
cond
*.robotage 0 =
start
'Communication
0 .txpos store
0 .typos store
'Identification Friend Foe or Food
0 .IFFF store
0 .notarget store
1 .friend store
2 .food store
3 .foe store
'Secure Conspec Constants
1 .algaminimalis store
'Situational Awareness
0 .situation store
0 .nothing store
1 .eating store
2 .fighting store
'Condition
0 .health store
1 .fine store
2 .injured store
3 .dying store
4 .intox store
stop
'-------- MAINTINENCE: Health --------
'Health Indication -Fine
cond
*.nrg 2000 >
*.body 1000 > and
*.pain 300 < and
*.poisoned 0 = and
*.paralyzed 0 = and
start
*.fine .health store
stop
'Health Indication -Injured
cond
*.pain 300 >
*.nrg 1000 > and
*.nrg 2000 < and
*.body 1000 < and
*.poisoned 0 = and
*.paralyzed 0 = and
start
*.injured .health store
stop
'Health Indication -Dying
cond
*.nrg 1000 <
*.body 1000 < and
start
*.dying .health store
stop
'Health Indication - Intoxicated
cond
*.poisoned 1 =
*.paralyzed 1 = or
start
*.intox .health store
stop
'-------- MAINTINENCE: Energy Birthties And Other Constants --------
' Get rid of birth tie
cond
start
.tie *.robage 1 add mult inc
.deltie inc
stop
cond
start
339 .memloc store
stop
'Body storage
cond
*.nrg *.body >
start
100 .strbody
stop
'Body feeding
cond
*.nrg *.body <
start
100 .fdbody
stop
'-------- IDENTIFICATION FRIEND FOE OR FOOD --------
'Can't see shit, captian
cond
*.eye1 0 =
*.eye2 0 = and
*.eye3 0 = and
*.eye4 0 = and
*.eye5 0 = and
*.eye6 0 = and
*.eye7 0 = and
*.eye8 0 = and
*.eye9 0 = and
start
*.nothing .situation store
*.notarget .IFFF store
stop
'Friendly Bot
cond
*.eyef 0 >
*.refshoot 0 > and
*.refeye *.myeye = and
*.health *.intox != and
start
*.nothing .situation store
*.friend .IFFF store
stop
'Food
cond
*.memval *.algaminimalis =
*.refeye *.myeye != and
*.IFFF *.friend != and
*.health *.intox != and
start
*.food .IFFF store
*.refxpos .txpos store
*.refypos .typos store
stop
'Foe
cond
*.refshoot 0 >
*.refkills 0 > or
*.eyef 0 > and
*.refeye *.myeye != and
*.IFFF *.friend != and
*.health *.intox != and
start
*.foe .IFFF store
*.refxpos .txpos store
*.refypos .typos store
stop
'-------- VISION --------
'NOTE: Current vision system taken from Slam Funk1.01c.
'To be replaced with better functioning system in future builds.
'Targeting genes. If it spots food, it turns to it. -From Slam Funk1.01c
cond
start
-1 .focuseye store
stop
'Eye4
cond
*.eye4 0 !=
*.refeye *.myeye != and
start
5 .aimsx store
stop
cond
start
1 .focuseye store
stop
'Eye6
cond
*.eye6 0 !=
*.refeye *.myeye != and
start
-5 .aimsx store
stop
cond
start
-2 .focuseye store
stop
'Eye3
cond
*.eye3 0 !=
*.refeye *.myeye != and
start
15 .aimsx store
stop
cond
start
2 .focuseye store
stop
'Eye7
cond
*.eye7 0 !=
*.refeye *.myeye != and
start
-15 .aimsx store
stop
cond
start
-3 .focuseye store
stop
'Eye2
cond
*.eye2 0 !=
*.refeye *.myeye != and
start
35 .aimsx store
stop
cond
start
3 .focuseye store
stop
'Eye8
cond
*.eye8 0 !=
*.refeye *.myeye != and
start
-35 .aimsx store
stop
cond
start
-4 .focuseye store
stop
'Eye1
cond
*.eye1 0 !=
*.refeye *.myeye != and
start
40 .aimsx store
stop
cond
start
4 .focuseye store
stop
'Eye9
cond
*.eye9 0 !=
*.refeye *.myeye != and
start
-40 .aimsx store
stop
cond
start
0 .focuseye store
stop
'-------- MOVEMENT --------
'Follow friends
cond
*.eye5 0 >
*.IFFF *.friend = and
*.situation *.nothing = and
*.health *.intox != and
start
*.refveldx .dx store
*.refvelUp .up store
30 .aimdx store
stop
'Doing nothing
cond
*.situation *.nothing =
*.IFFF *.notarget = and
start
10 .up store
stop
'-------- COMMUNICATION --------
cond
*.IFFF *.food =
*.IFFF *.foe = or
*.health *.intox != and
start
*.IFFF .out1 store
*.txpos .out2 store
*.typos .out3 store
stop
cond
*.IFFF *.notarget =
*.IFFF *.friend = or
start
*.IFFF .out1 store
0 .out2 store
0 .out3 store
stop
'Listen for signs of food, turn towards it if not doing anything more important
cond
*.in1 *.food =
*.situation *.nothing = and
*.health *.intox != and
start
*.in2 *.in3 angle .setaim store
30 .up store
*.eating .situation store
stop
'Listen for signs of trouble. Go fight if there is any and you're not hurt and busy eating.
cond
*.situation *.nothing =
*.situation *.eating = or
*.in1 *.foe = and
*.health *.intox != and
*.health *.dying != and
*.health *.injured = not
*.situation *.eating = not and and
start
*.in2 *.in3 angle .setaim store
30 .up store
*.fighting .situation store
stop
'-------- COMBAT --------
'Retreating gene
cond
*.health *.injured =
*.refnrg 1500 > and
*.health *.dying = or
*.IFFF *.foe = and
start
628 .aimdx store
20 .up store
stop
'Retaliate to shot outside vision
cond
*.shflav 0 !=
*.shflav -2 !=
start
1256 *.shang sub .setaim store
0 .shflav store
stop
'Shooting gene. Accurately targets food/foe and decides what type of shot to use.
cond
*.situation *.eating =
*.situation *.fighting = or
*.eye5 40 > and
*.refeye *.myeye != and
*.IFFF *.friend != and
start
*.refxpos *.refypos dist *.refvelup add *.xpos add
*.ypos *.refvelsx add
angle
*.refxpos *.refypos angle add
.setaim store
*.refxpos *.refypos dist 30 sub 500 div *.maxvel mult *.refvel *.vel *.refeye sgn mult sub 1 mult add .up store
*.refveldx .dx store
*.eyef *.refveldx 400 mult *.refbody div 4 add >
-6 .shoot store
32 .shootval store
*.refnrg *.refbody <
*.refpoison *.refshell < or
-1 .shoot store
1600 *.refvelsx 2 pow sub sqr *.xpos add
*.ypos *.refvelsx add
angle .lead store
*.refvelsx *.velsx <
1256 *.lead sub .lead store
dropbool
*.lead .aimshoot store
stop
'-------- REPRODUCTION --------
cond
*.health *.fine =
*.nrg 2000 > and
start
40 .repro store
314 .aimdx store
stop
'-------- OTHER --------
end
--- End code ---
I don't want to spend a week debugging this. It won't shoot, it deletes it's genes, it won't act properly (likely due to it not feeding) and I need to know why. parents are getting pushy, I have to go.
Ta-183:
Alright, I got back to school this morning and go straight to work. One of the things I suspected was to blame was the situational variables not being set at the proper times. I also assumed that I should simplyfy the requirements for the shooting gene to activate. And though not a fatal flaw, I found a problem with the shooting function I took from gimmick in that I had not copied over a custom variable it uses. It worked fine in all the 1.x builds it was used in, but I am still going to put it in for completeness' sake. Plus, it might even improve the performance of SF1.1 a bit. Once I get back to my computers at home I will be able to test the changes. 1.1 is working fine at the moment and I am fine tuning it for release. Once 2.0 has had the kinks worked out I am going to start coding the F1 version! It should be very deadly with tie feeding and virii/venom.
ikke:
--- Quote from: Ta-183 ---One of the things I suspected was to blame was the situational variables not being set at the proper times.
--- End quote ---
This is a likely candidate. I have glanced over your code, and it uses them a lot. Setting /resetting them, interactions between them and the order in which they are executed are not trivial. You made a very big step at once and I salute you for it, but this makes debugging hard.
I also noticed you use the number of genes for conspec (at least partly). Expanding on this might help you against current mimicking bots
--- Quote from: Ta-183 ---Once 2.0 has had the kinks worked out I am going to start coding the F1 version! It should be very deadly with tie feeding and virii/venom.
--- End quote ---
A capable F2 bot and F3 bot can use the same base. In F1 the logic is different. Some examples:
In F1 you rape veggies, not eat them.
Shot strenght is based on your body tie feeding is not. In F3 the reduction in shot effectiveness serves as a lower bound for body size. This bound is absent in F1. The effect: look at numbers of bots generated in F3 and F1 combat. They are not comparable.
In F2&3 search and destroy tactics work, the top bots in F1 is much more passive
In effect you are programming an entirely different bot with a new strategy for F1 as opposed to F2&3
Moonfisher:
Ok disregard this post. Was explaining about the defines needing propper memmory locations, but hadn't seen there was a page 2 and the second code posted had no issues there so
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version