### 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.

### Topics - rayz

Pages: [1]
1
##### 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 50def sineOut 51def pi 52def factor 53def aimHeading 410 def magnitude 54def turn 55 def aimTurn 56def factor2 57'set constantscond*.robage 1 =start31415 .pi store10000 .factor store32000 .factor2 store100 .magnitude store0 .aimHeading store*.tiepres .deltie store35 .turn store5 .aimTurn store'just to move them out of the way1221 .eye1width store1221 .eye2width store1221 .eye3width store1221 .eye4width store'1221 .eye5width store1221 .eye6width store1221 .eye7width store1221 .eye8width store1221 .eye9width storestop'manage bodycond*.body 10 <*.nrg 300 >start100 .strbody storestopcond*.nrg 500 <*.body 10 >start10 .fdbody storestopcondstart*.aim *.turn add .setaim store*.aimHeading *.aimTurn add .aimHeading storestop'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 aimheadingcond*.aimHeading 1256 >=start*.aimHeading 1256 sub .aimHeading storestopcond*.aimHeading 0 <start*.aimHeading 1256 add .aimHeading storestop'from here down it makes the bot move in the direction of *.aimheadingcondstart*.aimHeading *.aim sub .sineIn storestop'begin sineIn normalizationcond*.sineIn 0 <start*.sineIn 1256 add .sineIn storestopcond*.sineIn 1256 >start*.sineIn 1256 sub .sineIn storestop'Taylor expansion of sine functioncondstart628 *.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 storestopcondstart*.sineOut *.magnitude mult *.factor2 div .sx storestop'calculate value for .upcondstart314 *.aimHeading *.aim sub sub .sineIn storestopcond*.sineIn 0 <start*.sineIn 1256 add .sineIn storestopcond*.sineIn 1256 >start*.sineIn 1256 sub .sineIn storestop'Taylor expansion of sine functioncondstart628 *.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 storestopcondstart*.sineOut *.magnitude mult *.factor2 div .up storestop'end movement section'cond'*.nrg 500 >'*.body 1000 >='start'50 .repro store'stopend`

2
##### 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]
`condstartheading *.angle sub cosine magnitude mult .up storeheading *.angle sub sine magnitude mult .dx storestop`
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

3
##### 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 50def foodxpos 51def foodypos 52condstart-8 .shootval storestopcond*.body 50 <*.nrg 200 >start100 .strbody storestopcond*.body 50 >start10 .fdbody storestop'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'stopcondstart*.tiepres .deltie storestopcondstart359 .aimsx store*.maxvel .up storestop'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 =start0 .out1 store0 .out2 store0 .out3 store0 .foodxpos store0 .foodypos store0 .shoot storestop'Oh no, lost sight of it!cond*.refshoot *.myshoot = *.eye5 0 = |*.enemysighted 1 =start0 .out1 store0 .out2 store0 .out3 store0 .enemysighted store0 .shoot store0 .foodxpos store0 .foodypos storestop'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 store0 .aimsx store0 .shoot storestopcond*.refshoot *.myshoot =start0 .out1 store0 .fixpos storestopcond*.foodxpos 0 !=*.foodypos 0 !=*.enemysighted 0 =start*.foodxpos *.foodypos angle .setaim store0 .aimsx store*.maxvel .up store0 .shoot storestop'Let the chase begin!cond*.eye5 0 !=*.refshoot *.myshoot !=start1 .out1 store*.refxpos .out2 store*.refypos .out3 store1 .enemysighted store*.refxpos *.refypos angle .setaim store0 .aimsx store*.maxvel .up store0 .fixpos store0 .foodxpos store0 .foodypos storestopcond*.eye5 75 >*.refshoot *.myshoot !=start1 .fixpos storestopcond*.eye5 0 !=*.refshoot *.myshoot !=start-6 .shoot storestopcond*.eye5 25 < *.refshoot *.myshoot !=start0 .fixpos store0 .aimsx store'*.refxpos *.refypos angle .setaim store*maxvel .up storestopcond*.eye5 25 >*.refshoot *.myshoot =1 0 =start*.maxvel .down store0 .fixpos store0 .up store0 .shoot storestopd'Reproducecond *.nrg 1000 >*.fixpos 0 !=start50 .repro store0 .fixpos store0 .aimsx store0 .up store*.maxvel .dn storestopcond *.nrg 1000 >*.fixpos 0 =start0 .aimsx store50 .repro storestopend*.refxpos *.refypos angle .setaim store`

4
##### 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.

5
##### 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.

6
##### 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!).

7
##### Internet Mode Commentary / Multibot teleport problems
« on: April 05, 2008, 09:17:28 PM »
I didn't know if there was a topic like this before, but here goes:

When I started my sim, I loaded "Massed Hunter with Poison and Shell and Slime" as a starting bot.  After a while, the bots started to coalese into a huge mass of bots all connected with hardened ties.  Then I turned on Internet Mode.  However, the teleporter refused to teleport my bots-- it treated them as one huge organism, attempted to save it as an organism file,  and failed miserably.  Now I just have this mass of bots in my sim that will not teleport.  Anyone have a tip to help me teleport my bots?

Thanks!

-rayz

8
##### F2 bots / Massed Hunter with poison and shell and slime (F2) (rayz) (02-04-2008)
« on: April 02, 2008, 12:08:04 AM »
This is my first entry- the "Massed Hunter with poison and shell and slime".  Not a very original name, but all I could come up with. This is still a work in progress as I test it against other bots and tweak it.  Fires ties to anchor itself to food and then fires away at it.  It is meant for a food-intensive environment, as it just plows through all food.  Anyway, the code is below.

`cond*.nrg 750 > *.body 1000 <start100 .strbody storestopcond*.nrg 500 <*.body 1 >start100 .fdbody storestopcond*.shell 100 <*.nrg 750 >start100 .mkshell storestopcond*.slime 100 <*.nrg 750 >start100 .mkslime storestopcond*.poison 100 <*.nrg 750 >start100 .strpoison store7 .ploc storestopcondstart420 .eye1dir store315 .eye2dir store210 .eye3dir store105 .eye4dir store-105 .eye6dir store-210 .eye7dir store-315 .eye8dir store-420 .eye9dir storestopcondstart105 .eye1width store105 .eye2width store105 .eye3width store105 .eye4width store105 .eye5width store105 .eye6width store105 .eye7width store105 .eye8width store105 .eye9width storestopcondstart-4 .focuseye storestopcond*.eye1 0 >*.refaimsx *.myaimsx !=start560 .aimsx store0 .aimdx storestopcondstart4 .focuseye storestopcond*.eye9 0 >*.refaimsx *.myaimsx !=start560 .aimdx store0 .aimsx storestopcondstart-3 .focuseye storestopcond*.eye2 0 >*.refaimsx *.myaimsx !=start420 .aimsx store0 .aimdx storestopcondstart3 .focuseye storestopcond*.eye8 0 >*.refaimsx *.myaimsx !=start420 .aimdx store0 .aimsx storestopcondstart-2 .focuseye storestopcond*.eye3 0 >*.refaimsx *.myaimsx !=start280 .aimsx store0 .aimdx storestopcondstart2 .focuseye storestopcond*.eye7 0 >*.refaimsx *.myaimsx !=start280 .aimdx store0 .aimsx storestopcondstart-1 .focuseye storestopcond *.eye4 0 >*.refaimsx *.myaimsx !=start140 .aimsx store0 .aimdx storestopcondstart1 .focuseye storestopcond *.eye6 0 >*.refaimsx *.myaimsx !=start140 .aimdx store0 .aimsx storestopcondstart0 .focuseye storestopcond*.eye5 0 >*.refaimsx *.myaimsx !=*.numties 0 =start0 .aimsx store0 .aimdx store*.maxvel .up store1 .tie store0 .stifftie storestopcond*.eye5 25 >*.refaimsx *.myaimsx !=*.refnrg 0 >*.numties 0 =start-1 .shoot store4 .shootval store*.maxvel .up storestopcond*.eye5 25 >*.refaimsx *.myaimsx !=*.refnrg 200 <*.refbody 1 >*.numties 0 =start-6 .shoot store4 .shootval store10 .up storestopcond*.eye5 0 >*.refaimsx *.myaimsx !=*.numties 0 !=start0 .aimsx store0 .aimdx store10 .up store1 .tie store0 .stifftie storestopcond*.eye5 25 >*.refaimsx *.myaimsx !=*.refnrg 0 >*.numties 0 !=start-1 .shoot store4 .shootval store10 .up storestopcond*.eye5 25 >*.refaimsx *.myaimsx !=*.refnrg 200 <*.refbody 1 >*.numties 0 !=start-6 .shoot store4 .shootval store10 .up storestopcond*.eye5 0 >*.refaimsx *.myaimsx =start1 .tie store630 .aimsx store0 .aimdx store0 .stifftie storestopcond*.eye1 0 =*.eye2 0 =*.eye3 0 =*.eye4 0 =*.eye5 0 =*.eye6 0 =*.eye7 0 =*.eye8 0 =*.eye9 0 =*.numties 0 =start5 .up storestopcond*.nrg 100 <*.eye5 50 >*.refaimsx *.myaimsx =start1 .shootval store-2 .shoot storestopcond*.waste 100 >*.refaimsx *.myaimsx !=start-4 .shoot store*.waste .shootval storestopcond*.fixpos 0 !=start0 .fixpos storestopcond*.nrg 1000 >start50 .repro storestopend`