Basically, a replicator might look like this:
;name Paper 1
cnt EQU lst-src ; number of code in paper
src DAT #cnt ; source pointer
dst DAT #1222 ; destination pointer
pap MOV #cnt, src ; #cnt is number of lines to be copied
MOV <src, <dst ; copy a code...
JMN -1, src ; once at a time and
; loop back until all lines copied
SPL @dst ; split the process to a new copy
SUB #23, dst ; give more distance to the next copy
JMP pap ; make other copies
lst END papAt earlier time, this kind of warrior was also known as mice warrior. Against stones or dwarfs, they could easily overrun them.
;name Paper 2
cnt EQU lst-src ; number of code in paper
src MOV #cnt, 0 ; source pointer
MOV <src, <dst ; copy the code...
JMN -1, src ; once at a time
dst SPL @0, 1222 ; destination pointer
SUB #23, dst ; give more distance to next copy
JMZ src, src ; redo
lst END src
The second replicator doesn't need DAT for its pointers. Its pointers are used
in double usages with others. Instead of replicating 8 lines of code, it now
replicates 6 lines. This means smaller module and faster progress.
One way to design checksum is by observing how distinct own processes from opponent ones when running in a paper module. They are:
The concept is as follow:
;name Paper 3
cnt EQU dt - src
init SPL 1
MOV -1, 0
SPL 1 ; Create 6 on-line processes
src MOV #cnt, 0 ; Init number of lines to be copied
; This also serves as a source pointer
MOV <src, <dst ; Copy a line 6 times (make one full copy)
dst SPL @0, #1222 ; Split 6 times
MOV dt, <-1 ; Give more distance to next copy
JMZ src, src ; Test for checksum
MOV 0, -1 ; Attempt to erase that module
dt END init
The new warrior requires an initial set-up that creates 6
online processes. Down at the bottom is
a neat single piece of code. It is intended for all alien processes.
The checksum is such as in order to replicate successfully, there have to be
exactly 6 processes running synchronously. Failing the requirement should
trigger the self-erase routine at the bottom.