Author Topic: Overall Concept  (Read 7620 times)

Offline Shasta

  • Administrator
  • Bot Destroyer
  • *****
  • Posts: 231
    • View Profile
Overall Concept
« Reply #15 on: May 07, 2008, 10:37:47 PM »
This is not guaranteed but I think it should work to always try and get a sexual reproduction every 500 cycles. I crammed it into one gene but if you replace the starts with conds,  '''  with starts, and the  ''''''''''  with stops it would work the same:
[div class=\'codetop\']CODE[div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']def sexreprocalled 61 'remember defs go at the top
  def reprocalled 62
 
  cond
  start
  *.nrg 7500 <
  *.timer 430 >= and           'gives it some time to try and sexually reproduce, adjust as necessary
  *.refeye *.myeye = and    'if I see a bot of the  same species try to get it fertilized
   '''
  -8 .shoot store
  ''''''''''                               'essentially a new gene
  *.fertilized 0 !=
  *.sexreprocalled 1 != and
   '''
  50 .sexrepro store
  1 .sexreprocalled store
  ''''''''''
  *.nrg 7500 >
  *.timer 500 >=
  '''
  50 .repro store
  1 .reprocalled store
  ''''''''''
  *.sexreprocalled 0 !=
  *.reprocalled 0 != or
  *.timer 500 >= and
   '''
  0 .sexreprocalled store
  0 .reprocalled store
  0 .timer store
  stop

edit: If you want it to still  reproduce if below 7500 and didnt sexually reproduce you can check against .sexreprocalled and .reprocalled and  use .repro, with that you will always reproduce every 500th cycle.

So that should work, might not be the slickest way but oh well.
« Last Edit: May 07, 2008, 10:40:54 PM by Shasta »

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Overall Concept
« Reply #16 on: May 08, 2008, 02:27:41 AM »
I haven't messed around with in-gene boolean logic, but I think that if you don't want the conditions from the last block of code to carry on, you have to clear the stack with the command clearbool before writing your next set of conditions.
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Overall Concept
« Reply #17 on: May 08, 2008, 09:45:59 AM »
Quote from: bacillus
I haven't messed around with in-gene boolean logic, but I think that if you don't want the conditions from the last block of code to carry on, you have to clear the stack with the command clearbool before writing your next set of conditions.
Not necessarily.  This only matters if you perform boolean operations with the those values farther back on the stack.

for example:

false
10 .up store
true
true
and
50 .repro store

The bot above will reproduce but not move.

false
10 .up store
true
true
and and
50 .repro store

This one will neither move nor reproduce.
« Last Edit: May 08, 2008, 09:50:21 AM by EricL »
Many beers....

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Overall Concept
« Reply #18 on: May 09, 2008, 02:28:23 AM »
Ah, of course, how stupid of me. I was thinking of the way the cond command works.
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan