Miscellaneous tips & tricks

Bootstrapping

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)

Core-clear

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)

Self-splitting

Self-splitting 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.

Self-splitting 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
(back to Index)

Bombing/scanning pattern

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.

There are C source code and DOS executable file that compute best constant for any given modulo.

(back to Index)

Self-mutate

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 self-mutation 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)

On-Line Processes

Example:
For N = 10, its (N-1 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)