Difference between revisions of "Advanced Stack"

From WikiManual
Jump to: navigation, search
 
(Post 2.4)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
== Pre 2.4 ==
  
 
'''Saving Values into the Stack'''
 
'''Saving Values into the Stack'''
 
The Stack can be used as a means to save a value than retrieve it whenever necessary. The new dup operator allows the number to stay in the Stack continously
 
The Stack can be used as a means to save a value than retrieve it whenever necessary. The new dup operator allows the number to stay in the Stack continously
  
{code}
+
<pre>
 
cond
 
cond
 
*.robage 0 =
 
*.robage 0 =
Line 14: Line 15:
 
dup .tie store
 
dup .tie store
 
stop
 
stop
{code}
+
</pre>
 
 
 
This 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.  
 
This 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.  
  
 
'''Timing Actions with the Stack'''
 
'''Timing Actions with the Stack'''
 
Another more advanced use is to store a whole series of actions into the stack and then unstacking them in the following cycles.
 
Another more advanced use is to store a whole series of actions into the stack and then unstacking them in the following cycles.
 
+
<pre>
{code}
 
 
cond
 
cond
 
*.robage 0 =
 
*.robage 0 =
Line 29: Line 28:
 
10 .up
 
10 .up
 
stop
 
stop
 
+
 
cond
 
cond
 
start
 
start
 
dup
 
dup
 
stop
 
stop
 
+
 
cond
 
cond
 
0 >
 
0 >
 
' dup gene and 0 > not really needed in this case but helps to
 
' dup gene and 0 > not really needed in this case but helps to
' demo ability to sense the stack without destroying the information
+
' demo ability to sense the stack without destroying the information  
 
start
 
start
 
store
 
store
 
stop
 
stop
{code}
+
</pre>
 
 
 
This will cause the bot to perform the above actions from bottom to top.
 
This will cause the bot to perform the above actions from bottom to top.
This could also be used for anything from MB reproduction to more accurate aiming.  
+
This could also be used for anything from MB reproduction to more accurate aiming.
 
 
  
--------------------------------------------------------------------------------
+
== Post 2.4 ==
 +
The stack no longer carries values between cycles, making many of these techniques less useful than they were previously.
  
 
[[Stack]]
 
[[Stack]]

Latest revision as of 11:18, 22 December 2005

Pre 2.4

Saving Values into the Stack The Stack can be used as a means to save a value than retrieve it whenever necessary. The new dup operator allows the number to stay in the Stack continously

cond
*.robage 0 =
start
998 rnd 1 add
stopcond
*.refeye *.myeye !=
*.eye5 50 >
start
dup .tie store
stop

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

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

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 without destroying the information 
start
store
stop

This will cause the bot to perform the above actions from bottom to top. This could also be used for anything from MB reproduction to more accurate aiming.

Post 2.4

The stack no longer carries values between cycles, making many of these techniques less useful than they were previously.

Stack