Bots and Simulations > DNA - General

shootval and distance for -1 shots

<< < (2/5) > >>

peterb:
I was thinking...
Since the dist command does require a lot of complex calculations, is it the right thing to do ?
Or maybe use eye5 as its results isn't neither straightforward too  (the closer the faster the number increases)
Well I'm not sure but i got these values from a starting cell   
Still i got the problem of growing size of cells.. well eye5 grows with it maybe it solves it.

I collected from a test bot, using a lot of my time the following results
They are as abest as i could get it but I'm sure its not 100% correct. (90% at best)


--- Code: ---dist eye5 shootval
1600    1 -32
1375    2 -14
1034    3 -9
989    4 -7
904    5 -6
830    6 -5

--- End code ---
Then I found Eureqa some kind of free math formula finding program
It really is amazing it can find formulas behind data sets...   (so we require less scientists ??)
It does not have als darwinbots calculation options, no binary operators but a lot of others, so i had to limit it down.
Aldo couldn't use cos and sin functions.

It turned out that eye5 had a more easy relation to this then the distance value, resulting formula's looked better.
Now based on the eye5 valeu it found the folowing relation between shootval :
A lot depend on how accurate my values are .. and thats a bit of problem i just tried to do my best here.
Well the program found these relations between eye5 :


--- Code: ---]f(v) = 21.6136/(0.298103 - eye5) - 1.21081
--- End code ---

or


--- Code: ---f(v) = 25.0438/(0.217382 - eye5)
--- End code ---


But now i wonder, can i type these numbers into darwinbots?
Or does it only work wit rounded integer valeus ?????

ikke:

--- Quote from: peterb ---...

But now i wonder, can i type these numbers into darwinbots?
Or does it only work wit rounded integer valeus ?????

--- End quote ---
only when you push to the stack you need an int <32000
0.12*a = 12*a/100
BTW: you can look up the exact formulas in the source code

ashton15:
I tested

def f 100

cond
start
2504380 21782 *.eye5 100000 mult sub div 100000 div .f store
stop

It shows up as overflow, invalid bot so obviously numbers have to be under 32000 so I tried

def f 100

cond
start
25.04380 0.21782 *.eye5 sub div .f store
stop

0 is stored, so I went halfway so the numbers were under 32000

def f 100

cond
start
25043.8 217.82 *.eye5 1000 mult sub div .f store
stop

This is where I had the most sucsess, 115/109 is stored by default when nothing is in view (i'm unsure of at which point it changes) when another veg first comes into view -32 is stored first for 115 and -30 is stored for 109, I cannot remember the sequence for 115 though it was definiteely diffrent from the 109 one which goes -13, -9, -6, -5, -4, -3, -2, -1, 0 as the bot gets closer to the veg. It's getting there but slightly eratically anyways I tried plugging it into both of our codes combined to make

'test

def edist 61
def XXX 100

cond
*.eye5 0 >
start

25043.8 217.82 *.eye5 1000 mult sub div .edist store

'positive longer
'negative smaller

'XXX = how far a shot goes at shootval 0, you will have to work this out yourself

4 .XXX store

*.edist - *.XXX >= -2 .shootval store
*.edist - *.XXX 2 mult >= -4 .shootval store
*.edist - *.XXX 3 mult >= -8 .shootval store
*.edist - *.XXX 4 mult >= -16 .shootval store
*.edist - *.XXX 5 mult >= -32 .shootval store


'btw -32 is the lowest which can be stored in shootval

stop

cond
start
.shoot dec
stop

Good news

As the bot gets closer to the veg the value of shootval decreases and it can shoot at multiple distances based on this and make the correct correlation between distance and shootval.

Bad news

-16 doesn't ever show up in shootval, also -4 and -8 fall just short of the veg, I think it just means XXX just needs some jiggery pokery. Another thing is .shoot dec and *.refxpos *.refypos angle .setaim store have started behaving strangely, .shoot dec randomly fires short bursts when it sees a veg unless it's put in a gene of it's own and *.refxpos *.refypos angle .setaim store aims towards the point 0,0 in the top left hand corner whether it's looking at another bot/veg or not which tells me it isn't collecting data properly. Finally when something is a long way away it uses 5 store commands and always uses 5 conditionals which are a waste of energy... could be shrunk down using conditionless logic however. We are very almost there...

peterb:
i test usualy in phases, trying to exploit new ideas and then later combine them
i had to do the aiming to zero degrees, just for testing the ranges to get the valeus for eye5 and shootval
Aiming can be restored this way :

*.refxpos *.refypos angle .setaim store


ashton15:

--- Quote from: peterb ---i test usualy in phases, trying to exploit new ideas and then later combine them
i had to do the aiming to zero degrees, just for testing the ranges to get the valeus for eye5 and shootval
Aiming can be restored this way :

*.refxpos *.refypos angle .setaim store
--- End quote ---

I tried that, it works for bots but not veggies

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version