Author Topic: Advanced Stack uses  (Read 3062 times)

Offline Endy

  • Bot Overlord
  • ****
  • Posts: 852
    • View Profile
Advanced Stack uses
« on: May 07, 2005, 03:05:36 AM »
Figured out a location to save a value that cannot be affected by another bot, short of useing viruses. The Stack, itself. The new dup operator allows the value to be simultaneously available for use and saved in the stack.

This code:

cond
*.robage 0 =
start
998 rnd 1 add
stop

cond
start
dup .tie store
stop

will duplicate the value and also use it to tie. The same value can then be kept and re-used forever.

To use it as part of a condition statement requires a solo "dup" gene.

Another more advanced use is to store a whole series of actions into the stack and then unstacking them in the following cycles.

Code like:

cond
*.robage 0 =
start
50 .repro
314 .aimdx
10 .up
stop

cond
start
dup
stop

cond
0 >
' dup gene and 0 > not really needed in this case but helps to demo ability to sense the stack
start
store
stop

will cause the bot to perform the above actions from bottom to top.

This could be used for anything from MB reproduction to more accurate aiming.

Have fun playing, I'll try to make a full sized wiki about this in the future.

Endy B)