Difference between revisions of "Advanced Stack"

From WikiManual
Jump to: navigation, search
m (Pre 2.4)
(Post 2.4)
 
(One intermediate revision by one other user not shown)
Line 4: Line 4:
 
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
  
cond
+
<pre>
*.robage 0 =
+
cond
start
+
*.robage 0 =
998 rnd 1 add
+
start
stopcond
+
998 rnd 1 add
*.refeye *.myeye !=
+
stopcond
*.eye5 50 >
+
*.refeye *.myeye !=
start
+
*.eye5 50 >
dup .tie store
+
start
stop
+
dup .tie store
 
+
stop
 +
</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>
cond
+
cond
*.robage 0 =
+
*.robage 0 =
start
+
start
50 .repro
+
50 .repro
314 .aimdx
+
314 .aimdx
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
 
+
</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 ==
 
== Post 2.4 ==
The stack no longer carries values between cycles, making many of these techniques less useful than they were preciously.
+
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