Difference between revisions of "Rnd"
From WikiManual
Line 1: | Line 1: | ||
'''Overview''' | '''Overview''' | ||
+ | |||
The operator generates a random number. | The operator generates a random number. | ||
'''Use''' | '''Use''' | ||
+ | |||
State the maximal desired number. The operator will generate a random number between 0 and the specified maximal desired number. The random number is placed on the top of the stack. | State the maximal desired number. The operator will generate a random number between 0 and the specified maximal desired number. The random number is placed on the top of the stack. | ||
Line 18: | Line 20: | ||
'''Uses in Evolution''' | '''Uses in Evolution''' | ||
+ | |||
Several bots have been observed using the rnd operator in evolution sims. Presumably this allows the bot access to more memory locations and therefore a wider range of behaviors with little additional code. | Several bots have been observed using the rnd operator in evolution sims. Presumably this allows the bot access to more memory locations and therefore a wider range of behaviors with little additional code. | ||
Revision as of 20:10, 17 September 2005
Overview
The operator generates a random number.
Use
State the maximal desired number. The operator will generate a random number between 0 and the specified maximal desired number. The random number is placed on the top of the stack.
Example:
10 rnd 50 store
This stores a random number from 0 -10 in memory location 50.
This is most often used in combat sims to:
- generate different actions per cycle (1 rnd)
- randomize turning radius
- randomize number stored into .tie
Uses in Evolution
Several bots have been observed using the rnd operator in evolution sims. Presumably this allows the bot access to more memory locations and therefore a wider range of behaviors with little additional code.