Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - rayz

Pages: [1] 2
1
Interesting behaviour bots / Bot test 1
« on: April 15, 2009, 11:01:44 PM »
Quote from: bacillus
Very nicely done   . One minor thing I would change though is replace all that tedious wrapping with
Code: [Select]
*.sineIn 1256 mod .sineIn storeThis modulus function replaces the four genes you used.
I look forward to new innovations using this algoritm...  

one small problem that I found: at certain numbers, it reads numbers greater than 1 and less than -1, and at these values the value switches from something like 312... to -312...-- something a sine function does not do.

If somebody could take a look through it and see if there are any bugs, that would be great!

Thanks!

-Raymond

...School takes up too much time!

2
Interesting behaviour bots / Bot test 1
« on: April 03, 2009, 04:58:02 PM »
Since I went through all of the trouble to make it a bot to test my algorithm, I thought I might post it here.

It's an interesting behavior bot.  It approimates sine and cosine for use with direction setting. I think most of the stuff is explained in the comments.

I commented out a tracking and shooting section.  If you uncomment it (except for the shooting part), and make a new version with more .up store commands, you can have the two species of bots just run straight at each other and go into complex little loops.    

Anyway, here it is!

Works best in no costs environment, too inefficient to run otherwise.
Code: [Select]
'An attempt to make the bot move north no matter how it is turned.
'Lacks precision due to a integer-only stack.
'Attempt to correct that by waiting to divide bigs numbers till end.
'
'edit these to wherever--maybe pi should be epigenetic?
'sineIn and sineOut are input/output for Taylor series
'sineOut returns a number multiplied by factor2 (approx.)
'pi and factor are internal constants for sine calculation
'aimHeading is the absolute heading that the bot wants to travel
'magnitude is how approximately how fast (in Darwinbots units) the bot will travel
'turn is how much the bot itself turns each cycle--useful to sweep area around the bot
'aimTurn is how much the bot changes the heading each cycle.
def sineIn 50
def sineOut 51
def pi 52
def factor 53
def aimHeading 410
def magnitude 54
def turn 55
def aimTurn 56
def factor2 57

'set constants
cond
*.robage 1 =
start
31415 .pi store
10000 .factor store
32000 .factor2 store
100 .magnitude store
0 .aimHeading store
*.tiepres .deltie store
35 .turn store
5 .aimTurn store
'just to move them out of the way
1221 .eye1width store
1221 .eye2width store
1221 .eye3width store
1221 .eye4width store
'1221 .eye5width store
1221 .eye6width store
1221 .eye7width store
1221 .eye8width store
1221 .eye9width store
stop

'manage body
cond
*.body 10 <
*.nrg 300 >
start
100 .strbody store
stop

cond
*.nrg 500 <
*.body 10 >
start
10 .fdbody store
stop

cond
start
*.aim *.turn add .setaim store
*.aimHeading *.aimTurn add .aimHeading store
stop

'try to aim the eye and shoot
'cond
'*.refup *.myup !=
'*.eye5 0 !=
'start
'*.refxpos *.refypos angle .aimHeading store
'*.aimHeading *.aim sub *.turn sub .eye5dir store
'*.turn *.aim add *.aimHeading sub .aimshoot store
'-6 .shoot store
'*.nrg 2 div .shootval store
'stop
'
'cond
'*.waste 100 >
'start
'-4 .shoot store
'*.waste .shootval store
'stop

'begin movement section: it makes the bot move in the direction of aimHeading
'normalize aimheading
cond
*.aimHeading 1256 >=
start
*.aimHeading 1256 sub .aimHeading store
stop

cond
*.aimHeading 0 <
start
*.aimHeading 1256 add .aimHeading store
stop

'from here down it makes the bot move in the direction of *.aimheading
cond
start
*.aimHeading *.aim sub .sineIn store
stop

'begin sineIn normalization
cond
*.sineIn 0 <
start
*.sineIn 1256 add .sineIn store
stop

cond
*.sineIn 1256 >
start
*.sineIn 1256 sub .sineIn store
stop

'Taylor expansion of sine function
cond
start
628 *.sineIn sub *.pi mult 628 div *.factor div 1 pow *.factor2 mult 1 div 628 *.sineIn sub *.pi mult 628 div *.factor div 3 pow *.factor2 mult 6 div sub 628 *.sineIn sub *.pi mult 628 div *.factor div 5 pow *.factor2 mult 120 div add 628 *.sineIn sub *.pi mult 628 div *.factor div 7 pow *.factor2 mult 5040 div sub .sineOut store
stop

cond
start
*.sineOut *.magnitude mult *.factor2 div .sx store
stop

'calculate value for .up
cond
start
314 *.aimHeading *.aim sub sub .sineIn store
stop

cond
*.sineIn 0 <
start
*.sineIn 1256 add .sineIn store
stop

cond
*.sineIn 1256 >
start
*.sineIn 1256 sub .sineIn store
stop

'Taylor expansion of sine function
cond
start
628 *.sineIn sub *.pi mult 628 div *.factor div 1 pow *.factor2 mult 1 div 628 *.sineIn sub *.pi mult 628 div *.factor div 3 pow *.factor2 mult 6 div sub 628 *.sineIn sub *.pi mult 628 div *.factor div 5 pow *.factor2 mult 120 div add 628 *.sineIn sub *.pi mult 628 div *.factor div 7 pow *.factor2 mult 5040 div sub .sineOut store
stop

cond
start
*.sineOut *.magnitude mult *.factor2 div .up store
stop
'end movement section

'cond
'*.nrg 500 >
'*.body 1000 >=
'start
'50 .repro store
'stop
end

3
DNA - General / Multibot movement ideas
« on: April 03, 2009, 12:41:04 AM »
Near-final version:

I've reduced it back to a framework, on top of which almost everything can be added.
I've also commented out a section of the code that would turn the bot to enemies, make the bot go towards them, make eye5 point to them, and direct body shots to the enemy.

Code: [Select]
'An attempt to make the bot move north no matter how it is turned.
'Lacks precision due to a integer-only stack.
'Attempt to correct that by waiting to divide bigs numbers till end.
'
'edit these to wherever--maybe pi should be epigenetic?
'sineIn and sineOut are input/output for Taylor series
'sineOut returns a number multiplied by factor2 (approx.)
'pi and factor are internal constants for sine calculation
'aimHeading is the absolute heading that the bot wants to travel
'magnitude is how approximately how fast (in Darwinbots units) the bot will travel
'turn is how much the bot itself turns each cycle--useful to sweep area around the bot
'aimTurn is how much the bot changes the heading each cycle.
def sineIn 50
def sineOut 51
def pi 52
def factor 53
def aimHeading 410
def magnitude 54
def turn 55
def aimTurn 56
def factor2 57

'set constants
cond
*.robage 1 =
start
31415 .pi store
10000 .factor store
32000 .factor2 store
100 .magnitude store
0 .aimHeading store
*.tiepres .deltie store
35 .turn store
5 .aimTurn store
'just to move them out of the way
1221 .eye1width store
1221 .eye2width store
1221 .eye3width store
1221 .eye4width store
'1221 .eye5width store
1221 .eye6width store
1221 .eye7width store
1221 .eye8width store
1221 .eye9width store
stop

'manage body
cond
*.body 10 <
*.nrg 300 >
start
100 .strbody store
stop

cond
*.nrg 500 <
*.body 10 >
start
10 .fdbody store
stop

cond
start
*.aim *.turn add .setaim store
*.aimHeading *.aimTurn add .aimHeading store
stop

'try to aim the eye and shoot
'cond
'*.refup *.myup !=
'*.eye5 0 !=
'start
'*.refxpos *.refypos angle .aimHeading store
'*.aimHeading *.aim sub *.turn sub .eye5dir store
'*.turn *.aim add *.aimHeading sub .aimshoot store
'-6 .shoot store
'*.nrg 2 div .shootval store
'stop
'
'cond
'*.waste 100 >
'start
'-4 .shoot store
'*.waste .shootval store
'stop

'begin movement section: it makes the bot move in the direction of aimHeading
'normalize aimheading
cond
*.aimHeading 1256 >=
start
*.aimHeading 1256 sub .aimHeading store
stop

cond
*.aimHeading 0 <
start
*.aimHeading 1256 add .aimHeading store
stop

'from here down it makes the bot move in the direction of *.aimheading
cond
start
*.aimHeading *.aim sub .sineIn store
stop

'begin sineIn normalization
cond
*.sineIn 0 <
start
*.sineIn 1256 add .sineIn store
stop

cond
*.sineIn 1256 >
start
*.sineIn 1256 sub .sineIn store
stop

'Taylor expansion of sine function
cond
start
628 *.sineIn sub *.pi mult 628 div *.factor div 1 pow *.factor2 mult 1 div 628 *.sineIn sub *.pi

mult 628 div *.factor div 3 pow *.factor2 mult 6 div sub 628 *.sineIn sub *.pi mult 628 div

*.factor div 5 pow *.factor2 mult 120 div add 628 *.sineIn sub *.pi mult 628 div *.factor div 7

pow *.factor2 mult 5040 div sub .sineOut store
stop

cond
start
*.sineOut *.magnitude mult *.factor2 div .sx store
stop

'calculate value for .up
cond
start
314 *.aimHeading *.aim sub sub .sineIn store
stop

cond
*.sineIn 0 <
start
*.sineIn 1256 add .sineIn store
stop

cond
*.sineIn 1256 >
start
*.sineIn 1256 sub .sineIn store
stop

'Taylor expansion of sine function
cond
start
628 *.sineIn sub *.pi mult 628 div *.factor div 1 pow *.factor2 mult 1 div 628 *.sineIn sub *.pi

mult 628 div *.factor div 3 pow *.factor2 mult 6 div sub 628 *.sineIn sub *.pi mult 628 div

*.factor div 5 pow *.factor2 mult 120 div add 628 *.sineIn sub *.pi mult 628 div *.factor div 7

pow *.factor2 mult 5040 div sub .sineOut store
stop

cond
start
*.sineOut *.magnitude mult *.factor2 div .up store
stop
'end movement section

cond
*.nrg 500 >
'*.body 1000 >=
start
50 .repro store
stop
end

4
The Gene depository / True Aiming using only physics
« on: April 02, 2009, 12:54:27 PM »
Quote from: bacillus
If I were you, I wouldn't use .aimshoot. It's got the nasty tendency to do unpredictable things, although I did manage to find out that a.) it either uses a scale different to the other aiming features b.) it's measured going the wrong way or c.) it has a different starting point. Point is, it's very messy to work with.

I think it goes the wrong way.  These two lines of code make eye5 and the shot direction point the same way:

*.aimHeading *.aim sub .eye5dir store
*.aim *.aimHeading sub .aimshoot store



5
DNA - General / Multibot movement ideas
« on: April 02, 2009, 12:43:47 AM »
Just added a few small tweaks to make this a simplebot.
Forgot: Change "magnitude" to change how fast the bot will go.
sineIn and sineOut are inputs and outputs for the Taylor series
pi and factor are internal variables needed for the Taylor series
aimheading is the absolute heading (e.g. 0 for east, 314 for north, etc.) that the bot wants to go in.

Code: [Select]
'An attempt to make the bot move north no matter how it is turned.
'Lacks precision due to a integer-only stack.
'Attempt to correct that by waiting to divide bigs numbers till end.

'edit these to wherever--maybe pi should be epigenetic?
def sineIn 50
def sineOut 51
def pi 52
def factor 53
def aimHeading 410
def magnitude 54

'set constants
cond
*.robage 1 =
start
31415 .pi store
10000 .factor store
100 .magnitude store
628 .aimHeading store
stop

'try to aim the eye and shoot
cond
*.refsx *.mysx !=
*.eye5 0 !=
start
*.refxpos *.refypos angle .aimHeading store
*.aimHeading *.aim sub .eye5dir store
*.aim *.aimHeading sub .aimshoot store
-1 .shoot store
stop

cond
start
*.aim 10 add .setaim store
*.aimHeading 1 add .aimHeading store
*.aimHeading *.aim sub .sineIn store
stop

cond
*.sineIn 0 <
start
*.sineIn 1256 add .sineIn store
stop

cond
*.sineIn 1256 >
start
*.sineIn 1256 sub .sineIn store
stop

'Taylor expansion of sine function
cond
start
628 *.sineIn sub *.pi mult 628 div *.factor div 1 pow 1 div 628 *.sineIn sub *.pi mult 628 div *.factor div 3 pow 6 div sub 628 *.sineIn sub *.pi mult 628 div *.factor div 5 pow 120 div add 628 *.sineIn sub *.pi mult 628 div *.factor div 7 pow 5040 div sub .sineOut store
stop

cond
start
*.sineOut *.magnitude mult .sx store
stop

cond
start
314 *.aimHeading *.aim sub sub .sineIn store
stop

cond
*.sineIn 0 <
start
*.sineIn 1256 add .sineIn store
stop

cond
*.sineIn 1256 >
start
*.sineIn 1256 sub .sineIn store
stop

cond
start
628 *.sineIn sub *.pi mult 628 div *.factor div 1 pow 1 div 628 *.sineIn sub *.pi mult 628 div *.factor div 3 pow 6 div sub 628 *.sineIn sub *.pi mult 628 div *.factor div 5 pow 120 div add 628 *.sineIn sub *.pi mult 628 div *.factor div 7 pow 5040 div sub .sineOut store
stop

cond
start
*.sineOut *.magnitude mult .up store
stop

cond
*.nrg 4000 >
start
50 .repro store
stop
end

6
DNA - General / Multibot movement ideas
« on: April 02, 2009, 12:13:00 AM »
Got it!
It's not a multibot yet, but it can direct its heading according to the value stored in aimheading no matter what direction it is facing.  Because it uses an approximation, it's not perfect. Uses Taylor series to calculate sine.

Code: [Select]
'An attempt to make the bot move north no matter how it is turned.
'Lacks precision due to a integer-only stack.
'Attempt to correct that by waiting to divide bigs numbers till end.

'edit these to wherever--maybe pi should be epigenetic?
def sineIn 50
def sineOut 51
def pi 52
def factor 53
def aimHeading 410
def magnitude 54

'set constants
cond
*.robage 1 =
start
31415 .pi store
10000 .factor store
100 .magnitude store
628 .aimHeading store
stop

cond
start
*.aim 10 add .setaim store
*.aimHeading 10 add .aimHeading store
*.aimHeading *.aim sub .sineIn store
stop

cond
*.sineIn 0 <
start
*.sineIn 1256 add .sineIn store
stop

cond
*.sineIn 1256 >
start
*.sineIn 1256 sub .sineIn store
stop

'Taylor expansion of sine function--takes value in Darwinbots units and outputs sine of that value.
cond
start
628 *.sineIn sub *.pi mult 628 div *.factor div 1 pow 1 div 628 *.sineIn sub *.pi mult 628 div *.factor div 3 pow 6 div sub 628 *.sineIn sub *.pi mult 628 div *.factor div 5 pow 120 div add 628 *.sineIn sub *.pi mult 628 div *.factor div 7 pow 5040 div sub .sineOut store
stop

cond
start
*.sineOut *.magnitude mult .sx store
stop

cond
start
314 *.aimHeading *.aim sub sub .sineIn store
stop

cond
*.sineIn 0 <
start
*.sineIn 1256 add .sineIn store
stop

cond
*.sineIn 1256 >
start
*.sineIn 1256 sub .sineIn store
stop

cond
start
628 *.sineIn sub *.pi mult 628 div *.factor div 1 pow 1 div 628 *.sineIn sub *.pi mult 628 div *.factor div 3 pow 6 div sub 628 *.sineIn sub *.pi mult 628 div *.factor div 5 pow 120 div add 628 *.sineIn sub *.pi mult 628 div *.factor div 7 pow 5040 div sub .sineOut store
stop

cond
start
*.sineOut *.magnitude mult .up store
stop
end

7
DNA - General / Multibot movement ideas
« on: January 08, 2009, 12:52:54 AM »
Quote from: ikke
Three solutions:
use sine cosine and implement through polynominal approximation
use angle / pyth (pythagoras) and the formulas to calculate sine and cosine
vector decomposition have two parameters x and y to pass, and not heading and magnitude

How would you recommend implementing them?

Also, heading and magnitude are an easy way for the bot to move relative to its own heading--thus, there is less manipulation of variables, making it more efficient.

Thankee!

-rayz

8
DNA - General / Multibot movement ideas
« on: January 06, 2009, 09:56:01 PM »
Please forgive me if I'm being redundant and rambling.  I can be that way.   

I was thinking about how to move a large multibot.  I was thinking that one of the major problems in moving a large multibot is the difficulty in making each individual bot face the same direction... so I was trying to create an algorithm to make each individual bot move the same direction, no matter what the heading of the bot is at the time.   So this is my small mini-algorithm:

sine and cosine take the top value from the stack, and give back the sine and cosine values for that number (in Darwinbot units).
heading is a variable that is passed along ties-- it shows what heading the bots want to move in.
magnitude is a variable that is passed along ties-- it shows how fast the bot wants to move in the particular direction.

Code: [Select]
cond
start
heading *.angle sub cosine magnitude mult .up store
heading *.angle sub sine magnitude mult .dx store
stop

If this worked, then the heading could be determined by some sort of queen, and passed along to each bot using ties-- so each bot would move in the same direction, preventing the need for more complicated algorithms to deal with other suff.

It wasn't until I tried to implement this that I realized that the sine and cosine functions don't exist!    I then started thinking that a sine and function would be so nice to have...   Does anyone know if a sine and cosine function exist?  If so, what are they?  If not, how should I mimic them?

Thankee all!

-rayz

9
F1 bots / Bot v 1.1
« on: January 06, 2009, 12:25:53 PM »
Quote from: d-EVO
Code: [Select]
*.foodxpos 100 + *.xpos >= *.foodxpos 100 - *.xpos > |
*.foodypos 100 + *.ypos >= *.foodypos 100 - *.ypos > |

I dont think this code will work

replace the "+" with "add"
and the "-" with "sub"
and the "|" with "or"

so the code should look like this

Code: [Select]
*.foodxpos 100 add *.xpos >= *.foodxpos 100 sub *.xpos > or
*.foodypos 100 add *.ypos >= *.foodypos 100 sub *.ypos > or
and                 / note that the "and" is not nessiccary as this will automaticaly be used when no other evaluation function is used
                      /  usefull to use when using complicated conditions logic.

this should work.

Ooooooh... Thankee very much!    

10
F1 bots / Bot v 1.1
« on: January 05, 2009, 05:33:39 PM »
The predecessor of the no fixpos version...found that fixpos could be quite helpful.

Code: [Select]
def enemysighted 50
def foodxpos 51
def foodypos 52

cond
start
-8 .shootval store
stop

cond
*.body 50 <
*.nrg 200 >
start
100 .strbody store
stop

cond
*.body 50 >
start
10 .fdbody store
stop

'eye5 goes all around, eye1 now points forward
'eye1 at 0
'eye2 at 157 right
'eye3 at 314
'eye4 at 471
'eye6 at 628
'eye7 at 785
'eye8 at 942
'eye9 at 1099
'cond
'start
'1221 .eye5width store
'157 .eye1width store
'157 .eye2width store
'157 .eye3width store
'157 .eye4width store
'157 .eye6width store
'157 .eye7width store
'157 .eye8width store '35
'157 .eye9width store
'-140 .eye1dir store '0
'-262 .eye2dir store '1
'-384 .eye3dir store '2
'-506 .eye4dir store '3
'-593 .eye6dir store '4
'-715 .eye7dir store '5
'-837 .eye8dir store '6
'-959 .eye9dir store '7
'stop

cond
start
*.tiepres .deltie store
stop

cond
start
359 .aimsx store
*.maxvel .up store
stop

'I've arrived at the spot, but no food...better stop looking.
cond
*.foodxpos 100 + *.xpos >= *.foodxpos 100 - *.xpos > |
*.foodypos 100 + *.ypos >= *.foodypos 100 - *.ypos > |
*.enemysighted 0 =
start
0 .out1 store
0 .out2 store
0 .out3 store
0 .foodxpos store
0 .foodypos store
0 .shoot store
stop

'Oh no, lost sight of it!
cond
*.refshoot *.myshoot = *.eye5 0 = |
*.enemysighted 1 =
start
0 .out1 store
0 .out2 store
0 .out3 store
0 .enemysighted store
0 .shoot store
0 .foodxpos store
0 .foodypos store
stop

'cond
'*.eye5 0 >
'start
'0 .aimsx store
'*.maxvel .up store
'stop

'Someone's telling me where the food is!
cond
*.refshoot *.myshoot =
*.enemysighted 0 =
*.in1 0 !=
*.in2 0 !=
start
*.in2 .out2 store
*.in3 .out3 store
*.in2 .foodxpos store
*.in3 .foodypos store
0 .aimsx store
0 .shoot store
stop

cond
*.refshoot *.myshoot =
start
0 .out1 store
0 .fixpos store
stop

cond
*.foodxpos 0 !=
*.foodypos 0 !=
*.enemysighted 0 =
start
*.foodxpos *.foodypos angle .setaim store
0 .aimsx store
*.maxvel .up store
0 .shoot store
stop

'Let the chase begin!
cond
*.eye5 0 !=
*.refshoot *.myshoot !=
start
1 .out1 store
*.refxpos .out2 store
*.refypos .out3 store
1 .enemysighted store
*.refxpos *.refypos angle .setaim store
0 .aimsx store
*.maxvel .up store
0 .fixpos store
0 .foodxpos store
0 .foodypos store
stop

cond
*.eye5 75 >
*.refshoot *.myshoot !=
start
1 .fixpos store
stop

cond
*.eye5 0 !=
*.refshoot *.myshoot !=
start
-6 .shoot store
stop

cond
*.eye5 25 <
*.refshoot *.myshoot !=
start
0 .fixpos store
0 .aimsx store
'*.refxpos *.refypos angle .setaim store
*maxvel .up store
stop

cond
*.eye5 25 >
*.refshoot *.myshoot =
1 0 =
start
*.maxvel .down store
0 .fixpos store
0 .up store
0 .shoot store
stopd

'Reproduce
cond
*.nrg 1000 >
*.fixpos 0 !=
start
50 .repro store
0 .fixpos store
0 .aimsx store
0 .up store
*.maxvel .dn store
stop

cond
*.nrg 1000 >
*.fixpos 0 =
start
0 .aimsx store
50 .repro store
stop

end
*.refxpos *.refypos angle .setaim store

11
Interesting behaviour bots / Hunter Special Follower
« on: January 05, 2009, 05:03:49 PM »
Follows enemy bots.  Strangely effective for the little work I've put into it.

12
Interesting behaviour bots / Bot v 1.1 no fixpos
« on: January 05, 2009, 04:54:42 PM »
A bot that does well when the veggies are fixed.  Tries to swarm enemies.

13
Simulation Emporium / Planet Eater Experimentation
« on: January 05, 2009, 04:38:56 PM »
Some fun with the planet eaters motion!  Run it on "fast" mode for the best effects (faster movement!).

14
Internet Mode Commentary / Multibot teleport problems
« on: April 06, 2008, 04:45:10 PM »
Quote from: EricL
The limit is 50 cells.   There is a 50 cell limit on teleportation or any sort including from one side of the field to the other in terroidal fields.  I think this is appropriate.  What should have happened is that some of your mass of bots - all those attached to the bot that encounterred the teleporter and those attached to those, etc. up to the 50 limit - should have gotten teleportted.  Some of them did teleport.  I saw them in my sim.   But you seem to imply there was an error of some sort.  What exactly occurred and could you please post a sim if you think something other than what I describe occurred?  Thanks.

Apparantly the teleporter failed to break them up once.  It hasn't happened since.

Thanks!

-rayz

15
Internet Mode Commentary / Multibot teleport problems
« on: April 05, 2008, 09:26:09 PM »
Oh, and the size of the group of bots that are tied is ~1500 bots and rising.

Pages: [1] 2