Welcome To Darwinbots > Newbie

Overall Concept

<< < (3/4) > >>

EricL:
You mispelled robage as "robbage" above in a couple places.

Also, it should be either .robage or *.robage depending on what you are trying to do.  .robage is just an easy way to refer to the number 9 I.e. memory location #9 is where the simulator uses to write the age of the bot.  *.robage will be the contents of memory location 9, the bot's actual age.

Note that .robage is read only.  The simulator will overwrite whatever the bot stores there every cycle.

Also, the minus sign "-" is not subtraction.  It negates the top value on the stack.   I think you want "sub".

Trooper5445:
Is there anyway to set some form of timer then so I can have reproduction be simultaneous?

Numsgil:
Use *.timer.  It's guarenteed to stay in sync between children and parents (unless you overwrite it of course).

Trooper5445:
Argh, code is all messed up. The Bots are not firing and Reproduction is messed up with none taking place. I can't seem to locate the problem.


--- Code: ---' L-Sesilia
' A robot that really doesn't want to do anything
' With help from the kind community (EricL, Shasta)
' Lazy Sessile

' Gene 11 - Sexual Reproduction if energy is less than 7500
cond
  *.nrg 7500 <
  *12 .timer 500 >
start
  12 .timer 500 -
  -8 .shoot store
  50 .sexrepro
stop

' Gene 10 - Reproduce asexually if energy is greater than 7500
cond
  *.nrg 7500 >
  *.timer 500 >
start
  25 .repro store
  12 .timer 500 -
stop

' Reproducing Allowing gene (Test)
cond
start  
  12. timer 0 =
stop

' Gene 6 - Dispose of excess waste
cond
  *.waste 45 >
start
  -4 .shoot store
  *.waste .shotval store
stop

' Gene 5 - Persue Food by acceleration
cond
  *.refye 5 !=
start
  5 .up store
stop

' Gene
cond
  *.eye9 *.eye5 >
start
  25 .aimdx store
stop

' Gene
cond
  *.eye1 *.eye5 >
start
  25 .aimsx store
stop

' Gene 3 - Shoot if location 75 is equal to one
cond
  *.75 1 =
start
  -1 .shoot store
stop

' Set location 75 to 0 if nothing is seen
cond
  *.eye5 0 =
start
  0 75 store
stop

' Set location 75 to 1 if something is seen in eye5
cond
  *.eye5 0 >
start
  1 75 store
stop

end
--- End code ---

goffrie:

--- Quote from: Trooper5445 ---Argh, code is all messed up. The Bots are not firing and Reproduction is messed up with none taking place. I can't seem to locate the problem.
--- End quote ---

Woah. "*12 .timer 500 >" ? That doesn't do a whole lot (is always false), and your *12 seemingly doesn't do anything.
You're missing a few "store"s, and I don't think your sexual reproduction genes are exactly working. You can't just randomly fire off a -8 shot and also store 50 in .sexrepro, that doesn't do anything but impregnate a bot in front of you. If that bot happens to be you own species, it won't try to reproduce for another 500 cycles and by that time the fertilized-ness will have worn off. Finally, your position-75 storing for eye5 is pretty useless, you could just replace that condition directly with an eye5 condition.

Most of these things fixed, plus spelling errors. (I didn't fix the sexual-reproduction problem, as I can't think of any good way to fix that with your desired 500-cycle reproduction.)

--- Code: ---' L-Sesilia
 ' A robot that really doesn't want to do anything
 ' With help from the kind community (EricL, Shasta)
 ' Lazy Sessile
 
 ' Gene 11 - Sexual Reproduction if energy is less than 7500
 cond
   *.nrg 7500 <
   *.timer 500 >=
 start
   0 .timer store
   -8 .shoot store
   50 .sexrepro store
 stop
 
 ' Gene 10 - Reproduce asexually if energy is greater than 7500
 cond
   *.nrg 7500 >
   *.timer 500 >=
 start
   25 .repro store
   0 .timer store
 stop
 
 
 ' Gene 6 - Dispose of excess waste
 cond
   *.waste 45 >
 start
   -4 .shoot store
   *.waste .shootval store
 stop
 
 ' Gene 5 - Persue Food by acceleration
 cond
   *.refeye *.myeye !=
 start
   5 .up store
 stop
 
 ' Gene
 cond
   *.eye9 *.eye5 >
  *.eye5 0 =
  *.refeye *.myeye = or
 start
   25 .aimdx store
 stop
 
 ' Gene
 cond
   *.eye1 *.eye5 >
  *.eye5 0 =
  *.refeye *.myeye = or
 start
   25 .aimsx store
 stop
 
 ' Gene 3 - Shoot if something is seen which isn't a conspec
 cond
   *.eye5 0 >
  *.refeye *.myeye !=
 start
   -1 .shoot store
 stop
 
 end
--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version