Difference between revisions of "Inc/dec"

From WikiManual
Jump to: navigation, search
m (Fixed typos)
 
(9 intermediate revisions by 6 users not shown)
Line 1: Line 1:
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.
 
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:
+
==[[Operators]]:==
 +
{{Store Commands}}
  
50 inc
+
=== Example:===
 +
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.
Line 10: Line 11:
 
For Example:  
 
For Example:  
  
50 dec<br>
+
50 dec
50 dec<br>
+
50 dec
50 dec<br>
+
50 dec
  
 
Subtracts 3 from *50.
 
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>
+
cond
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 effectively 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)
+
==Pre 2.4==
 +
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.
  
'''Value freezing using inc/dec'''
+
==Post 2.4==
 +
All memory locations can be modified with inc/dec, but inc/dec now cost nrg. Cost is equal to 1/10th of a store command. Stuff like value freezing will now cost the bots a set amount of nrg per turn. Such "cheating" methods such as for example, increasing repro(300) some fifty times, or constant use of inc/dec, will now cost the bots a reasonable amount of nrg.
  
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.
+
==Value freezing using inc/dec==
  
' Basic method to demonstrate freezing<br>
+
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 continuously storing it.
' Will keep .tieloc at -1 permanently<br>
+
 
cond<br>
+
' Basic method to demonstrate freezing
start<br>
+
' Will keep .tieloc at -1 permanently
.tieloc *.tieloc dup div mult inc<br>
+
cond
.tieloc dec<br>
+
start
stop' More complex method demonstrates freezing<br>
+
.tieloc *.tieloc dup div mult inc
' at a value with .ploc=7<br>
+
.tieloc dec
cond<br>
+
stop 'More complex method demonstrates freezing
start<br>
+
      'at a value with .ploc=7
' When *.ploc = 7 dec by 1<br>
+
cond
.ploc *.ploc 7 sub 1000 mult add dec<br>
+
start
.ploc inc<br>
+
  'When *.ploc = 7 dec by 1
stop<br>
+
.ploc *.ploc 7 sub 1000 mult add dec
 +
.ploc inc
 +
stop
 +
 
 +
Warning inc/dec now cost nrg limiting the effectiveness of such constant usage.

Latest revision as of 20:43, 14 February 2014

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.

Operators:

Store Commands:

store
inc dec

The following commands are not supported in versions earlier 2.46:

addstore
substore
multstore
divstore
ceilstore
floorstore
rndstore
sgnstore
abstore
sqrstore
negstore

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 effectively as an inter-gene signal and method to "freeze" values.

Pre 2.4

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.

Post 2.4

All memory locations can be modified with inc/dec, but inc/dec now cost nrg. Cost is equal to 1/10th of a store command. Stuff like value freezing will now cost the bots a set amount of nrg per turn. Such "cheating" methods such as for example, increasing repro(300) some fifty times, or constant use of inc/dec, will now cost the bots a reasonable amount of nrg.

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 continuously 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

Warning inc/dec now cost nrg limiting the effectiveness of such constant usage.