Miscellaneous tips & tricks
Some warriors bootstrap their codes by copying their functional ones to
somewhere distant from their original ones. Its general purposes are to
arrange a better setup and to leave the original codes as decoys.
(back to Index)
A core clear is basically a linear bombing stone. Its size and function
fit in many warriors as the routine that completely clear the arena.
Typical core clear is:
mov 2, <1
jmp 1, 1
or:
spl 0, 0
mov 2, <1
jmp 1, 1
The presence of SPL 0 is to prevent the warrior from self
termination.
(back to Index)
Selfsplitting or SPL 0 is such a peculiar instruction that can be
used as either a weapon or a protection.
As a weapon, SPL 0 is usually accompanied by JMP 1 and thrown together into
the core. These two instructions are very lethal against
replicators because they can hinder and
eventually stall their progress.
Selfsplitting can also be used to improve the warrior endurance.
Consider the following example:
MOV 3, 3
ADD #165, 1
JMP 2
If any part of this code is hit, the program will terminate immediately.
Now compare it with the following:
SPL 0
MOV 3, 3
ADD #165, 1
JMP 2
After few cycles are running, this small module have accumulated some
processes in its loop. A hit to any of its parts will not stop it
from running. Furthermore, a single hit to either the first or the
last instruction will still let the program remain operational.
There is a notable difference between the following routines:
SPL 0 SPL 0
MOV 3, 3 MOV 3, 3 ADD #165, 1
ADD #165, 1 ADD #165, 1 MOV 3, 3
JMP 2 JMP 2 JMP 2
The difference is due to the way SPL works. For comparison:

No selfsplitting routine works as:
MOV, ADD, MOV, ADD, MOV, ADD, MOV, ADD, MOV, ADD, MOV, ADD, ...

Selfsplitting routine 1 works as:
MOV, ADD, MOV, ADD, MOV, MOV, ADD, MOV, ADD, MOV, ADD, MOV, ...

Selfsplitting routine 2 works as:
ADD, MOV, ADD, MOV, ADD, ADD, MOV, ADD, MOV, ADD, MOV, ADD, ...
(back to Index)
Such kind of pattern is typically shown in:
(C * i) mod coresize.
C is an integer number that is repetitively added to or subtracted
from another number. If C is one, then the formed pattern will be similar
to that of linear bombing or scanning.
i is the nth times of addition or subtraction.
coresize is the size of the arena.
The measurement of good constant number C is generally characterized by
how swift the module employing C can fully break the arena down into smaller
fragments whose size is equal or less than N. N here is the expected
fragmentation size. The smaller the N, the slower the break down process.
This is understandable as the smaller the N, the more the fragmentation is
needed.
There is also a lower limit in which a fragment cannot be broken into smaller
ones. Thus this limit number sets as the minimum fragment size and it depends
on the chosen constant number. Modulo is associated with
this limit number. A pattern of modulo 5 means that the arena cannot be broken
into fragments whose size is smaller than 5. For every five cells in a row,
four of them cannot be touched and left as gaps. Another term for modulo is
the greatest common divisor or gcd between the constant C and the coresize.
Below is the list of some constants that produce best pattern for any given
modulo in coresize 8000:
 1 3039 3359
 2 2234 3094
 4 3044 3364
 5 2365 3315
 8 2376 2936
There are
C source
code and
DOS
executable file that compute best constant for any given modulo.
(back to Index)
This is a beauty in corewar programming. A simple few lines of code
can have more than one function or behavior. Not all of them are readily
apparent until the code undergoes selfmutation or hits itself on its own
purpose during its course. This is cheap and highly effective.
Twill, for example is designed as a very capable
stone that changes its behavior four times during its full course.
(back to Index)
OnLine processes are several processes that run at the same line everytime.
They are very useful in many prototypes especially
paper. The formula to create N number of
these processes:
 Subtract N by 1.
 Encode (N1) into its equivalent binary value.
 Starting from left to right, replace every 1 with "SPL 1" and every 0 with
"MOV 1, 0".
Example:
For N = 10, its (N1 or 9) equivalent binary value is: 1001.
The sequence is:
SPL 1 ;1
MOV 1, 0 ;0
MOV 1, 0 ;0
SPL 1 ;1
(back to Index)
(back to Trilogy)