Difference between revisions of "Inc/dec"
Line 6: | Line 6: | ||
50 inc | 50 inc | ||
− | adds 1 to 50. When more are used simultaneously the effects are cumulative. | + | adds 1 to *50. When more are used simultaneously the effects are cumulative. |
For Example: | For Example: | ||
− | 50 | + | 50 dec<br> |
− | 50 | + | 50 dec<br> |
− | 50 | + | 50 dec<br> |
− | + | Subtracts 3 from *50. | |
One of the more popular uses of this is for birth tie removal. | One of the more popular uses of this is for birth tie removal. | ||
− | < | + | cond<br> |
− | + | start<br> | |
− | start | + | .tie *.robage 1000 mult add inc<br> |
− | .tie *.robage 1000 mult add inc | + | .deltie *.robage 1 sub 1000 mult add inc<br> |
− | .deltie *.robage 1 sub 1000 mult add inc | + | stop<br> |
− | stop | + | |
− | < | ||
It has also been used effectivly as an inter-gene signal and method to "freeze" values. | It has also been used effectivly as an inter-gene signal and method to "freeze" values. | ||
− | Not all locations can be handled with them, memlocs 1-8(more?) can not be inc/dec. This is to ensure that the bots are required to expend some energy. | + | Not all locations can be handled with them, memlocs 1-8(more?) can not be inc/dec. This is to ensure that the bots are required to expend some energy. (Note: being changed in new version) |
'''Value freezing using inc/dec''' | '''Value freezing using inc/dec''' | ||
Line 32: | Line 31: | ||
This technique allows you to "freeze" values or to raise/lower a number to a value and then keep it there. This is best used for when you need a value at a constant number, but without the cost of continously storing it. | This technique allows you to "freeze" values or to raise/lower a number to a value and then keep it there. This is best used for when you need a value at a constant number, but without the cost of continously storing it. | ||
− | + | ' Basic method to demonstrate freezing<br> | |
− | ' Basic method to demonstrate freezing | + | ' Will keep .tieloc at -1 permanently<br> |
− | ' Will keep .tieloc at -1 permanently | + | cond<br> |
− | cond | + | start<br> |
− | start | + | .tieloc *.tieloc dup div mult inc<br> |
− | .tieloc *.tieloc dup div mult inc | + | .tieloc dec<br> |
− | .tieloc dec | + | stop' More complex method demonstrates freezing<br> |
− | stop' More complex method demonstrates freezing | + | ' at a value with .ploc=7<br> |
− | ' at a value with .ploc=7 | + | cond<br> |
− | cond | + | start<br> |
− | start | + | ' When *.ploc = 7 dec by 1<br> |
− | ' When *.ploc = 7 dec by 1 | + | .ploc *.ploc 7 sub 1000 mult add dec<br> |
− | .ploc *.ploc 7 sub 1000 mult add dec | + | .ploc inc<br> |
− | .ploc inc | + | stop<br> |
− | stop | ||
− | < |
Revision as of 19:35, 17 September 2005
Increase/Decrease These operators, inc(increase) and dec(decrease), are some of the most useful but are infrequently used. They work by either decreasing or increasing a memory location by 1.
For example:
50 inc
adds 1 to *50. When more are used simultaneously the effects are cumulative.
For Example:
50 dec
50 dec
50 dec
Subtracts 3 from *50. One of the more popular uses of this is for birth tie removal.
cond
start
.tie *.robage 1000 mult add inc
.deltie *.robage 1 sub 1000 mult add inc
stop
It has also been used effectivly as an inter-gene signal and method to "freeze" values.
Not all locations can be handled with them, memlocs 1-8(more?) can not be inc/dec. This is to ensure that the bots are required to expend some energy. (Note: being changed in new version)
Value freezing using inc/dec
This technique allows you to "freeze" values or to raise/lower a number to a value and then keep it there. This is best used for when you need a value at a constant number, but without the cost of continously storing it.
' Basic method to demonstrate freezing
' Will keep .tieloc at -1 permanently
cond
start
.tieloc *.tieloc dup div mult inc
.tieloc dec
stop' More complex method demonstrates freezing
' at a value with .ploc=7
cond
start
' When *.ploc = 7 dec by 1
.ploc *.ploc 7 sub 1000 mult add dec
.ploc inc
stop