Welcome To Darwinbots > Newbie

A Few Questions

<< < (2/2)

Slavakion:
Is there a limit to how many store commands can be executed in a cycle -- or more importantly, a limit to how much energy can be wasted on stores?

--- Code: ---' Virus Proper // Gene 9
' =========
cond
  77 *42 !=
  *.nrg 1 >
start
  *.eye5 *.eye5
  100 .up store
  -100 .up store
... [bunch more]
  100 .up store
  -100 .up store
  999 rnd
stop
--- End code ---
Just for foolin' around until I get the hang of it. A couple of eye references to throw off refeye conspecific avoidance, a bunch of stores to eat energy, and a random number tossed on the stack to throw off navigation.

I was reading the self-propagating virus example, and what does the sgn operator do? Change signs?

Numsgil:
-6 shots only are stopped by shell.  Poison won't touch them.  -1 shots are only stopped by poison, shell won't touch them.

You can't control how much nrg/cycle your bot uses up.  Each store command costs .2 nrg by default, so it's not a huge burden.

The sgn operator returns the sgn of the top number on the stack (that is, -1 or +1).  The readme contains information on several sysvars and operators that were added in 2.35 (sgn operator included).

Slavakion:

--- Code: ---250
'*.vtimer = 1 then shoot virus
*.vtimer 2 sub sgn
'-1 if ready, 1 else
-1 mult
'1 if ready, -1 else
1 add 3 div
'1 if ready, 0 else
.vshoot mult store

'*.vtimer = 0 then make virus
*.thisgene
*.vtimer 1 sub sgn -1 mult
'now have 1 if making, -1 else
1 add
'2 if making, 0 else
3 div
'1 if making, 0 else
.mkvirus mult store
--- End code ---
The last line of each "subgene" -- shouldn't the mult operator come before .vshoot or .mkvirus? Or does it not matter because you haven't stored the number yet, just declared that it's going to be stored in .vshoot? I hate Reverse Polish Notation...

Numsgil:
Here's how a SB (short gene bot)'s genome will work.  Once you understand the form, it makes it all alot easier.

In a regular bot, it's:

value location store

IN a smaller bot it's:

1.  a bunch of operations to get value

2.  A bunch of operations to arrive at either 1 or 0 (or some other value, you'll see in a minute)

3.  put the location on the stack

4.  multiply the last two things.  1 * location = location.  0 * location = 0.  If you try to store to a non existant memory address, you aren't charged any energy (but neither have you just acconplished anything.)  As long as you try to store to <1 or >1000 nothing happens.

5. store command.

So that last mult you're confused about is step #4.  For instance, the second one is basically *.thisgene (.mkvirus or 0) store.

Navigation

[0] Message Index

[*] Previous page

Go to full version