Difference between revisions of "Conditionless Bots"

From WikiManual
Jump to: navigation, search
(Conditionless bots complete for now)
(Conditionless bots complete for now)
Line 96: Line 96:
 
A equals 1 if no value is zero and if an even number or none of evaluations are negative.
 
A equals 1 if no value is zero and if an even number or none of evaluations are negative.
  
More to come as I'm still working on this myself.--[[User:66.91.141.218|66.91.141.218]] 22:51, 22 Jan 2006 (MST)
+
More to come as I'm still working on this myself.--[[User:Endy]] 22:51, 22 Jan 2006 (MST)

Revision as of 01:52, 23 January 2006

These are bots that use boolean style logic gates, created from basic math rules and equations.

Typically this is done to reduce costs associated with normal conditions. These are most likely found in Single Gene bots, but can also be used in more normal bots.

True or False

True conditions result in the memory location being multiplied by 1. A false results in a 0 or -1 multipliation, stoping the action.

Basic

The simpliest memory locations to use are those that are already either a one or zero; .hit, .edge, and .fixed are prime examples.

20 .up *.hit mult store
.hit *.hit mult dec

This code moves the bot whenever it is hit, then zero's the memory location of hit. Since hit can only have the values zero or one it's a breeze to use.

Suppose now we want the bots to react when a value is zero, like say looking around when nothing is seen. A typical mult will cause the bot to cancel the action. To use zero we'll have to convert it into a one.

314 rnd .aimdx
*.eye5 sgn 1 sub -1 mult mult
store

The middle is the code we're interested in. First the sign(sgn) of eye5 is found, then one is subtracted(sub) from it; resulting in zero(positive value) or -1(no value). Next it is multiplied by -1, perhaps the most important step this takes advantage of zero remaining the same and -1 becoming a positive one. At last we have our true value which we multiply by aimdx to make the bot turn only when it doesn't see anything.

Moderate

Equal or Not?

The next step is to allow the bots to determine wether or not a sysvar is equal or not equal, to a particular value or another sysvar.

This is easily accomplished by reducing the sysvar to a more usable value in this case zero or one.

314 rnd .aimdx
*.refeye *.myeye sub sgn abs mult 1 sub -1 mult mult
store

Similar to the previous dna this will cause a bot to turn, however this dna will only activate if the bots are related(hopefully).

First refeye is subtracted(sub) from myeye, resulting in a zero or a variable X. Since X could be positive or negative we find the sign and absolute of it, resulting in our favorite 1. With help from our conversion dna, they flip and we have our true statement of one that we multiply by allowing the bot to avoid kin.

Greater or Less?

Most widely used of all conditions is greater than and less than. Mostly in regulatory functions these allow bots to determine relationships between values in a less cut and dry manner than equal or not.

50 300
*.nrg 5000 sub sgn mult
store

This dna allows a bot to reproduce whenever it's energy level is greater than 5000. When this occurs the sign returns one and the bot reproduces. The values of -1 and 0 result in a null storage location costing the bot nothing.

Caution: When using sgn care should be taken with the negative results, compound use of solitary sgns can result in false results.

If we wanted a less than we would flip 5000 and nrg or if necessary use the conversion dna to obtain the values we want.

Hard

Logic

For most operations using mult works well to form an AND.

X mult Y mult Z mult

In this pseudo code X, Y, and Z represents expressions evaluating to a one or zero. If all are 1 or true the action occurs. If even one of the expressions is zero or false the action is canceled.

Suppose we want to shorten the dna by using OR allowing an action even if one of the expressions is false? To do this we can add the numbers then find their sign and absolute value to obtain our one.

X Y add Z add sgn abs mult

If one or more is 1 the action occurs. If all are zero it is canceled. A practical use of this is shown below.

314 rnd .aimdx
*.refeye *.myeye sub sgn abs 1 sub -1 mult *.eye5 sgn mult
*.eye5 sgn 1 sub -1 mult
add sgn abs mult
store

Combining two of the dna's we've seen before this will cause the bot to turn whenver nothing or kin are seen. Useful in terms of shortening dna length and allowing similar actions to be activated by different conditions.

Expert

To continue we need to understand some important properties of zero, one, and negative one; as they relate to one another in DB.

  • 1-1=0
  • 1x-1=-1
  • -1x-1=1
  • X/0=0
  • 0/0=0

Simple yet complex in application. The last two are worth a mention, in DB division by zero causes no error, but generates a typical zero. Useful in coding as the alternative form of sgn abs, dup div widely used prior to the upgrade.

For X, Y, Z equal to either (1,0,-1)

X Y mult Z mult ' = A

A equals 1 if no value is zero and if an even number or none of evaluations are negative.

More to come as I'm still working on this myself.--User:Endy 22:51, 22 Jan 2006 (MST)