Conditionless Bots

From WikiManual
Revision as of 01:11, 23 January 2006 by Endy (talk | contribs) (sg secrets :))
Jump to: navigation, search

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.

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 the a less than we would flip 5000 and nrg or if necessary use the conversion dna to obtain the values we want.

Hard