Imps are a special sub-type of
paper warriors. They
replicate by moving all the main body instructions somewhere
else, using the mov command.
Besides the normal imp, there are imp-worms, imp-guns,
imp-rings, imp-spirals, and gate-crashing imp-spirals.
The basic imp consists of one statement, mov 0,1 .
What this does is move the current instruction to the
next instruction (mov 0,1 means "move instruction at
relative position 0 to relative position 1". The core will
then execute the next instruction, repeating the process.
Note that due to this, normal imps cannot ever win (unless
the enemy commits suicide). If an enemy warrior is
overwritten with mov 0,1 , it'll just start
executing that command as well, creating a tie.
An normal imp is next to useless, since one hit will kill it
(a DAT at relative position 1 after mov 0,1 has been
executed).
An imp gun continually creates new imps. Its code is as
follows:
gun mov imp, 1337 ; move instruction at imp to relative pos 1337
spl @gun ; start a new process at position 1337
add #1337, gun ; add 1337 to the b-field of gun
jmp gun ; and reload
imp mov 0,1 ; the imp
What happens is that it first places a mov 0,1 instruction
at 1337. Then it splits to a new process at that location,
starting the imp, jumps back to the label "gun", and
repeats. This warrior can never win, and is very slow (due
to the immense number of processes generated). It is very
hard to destroy, but
scissors can do it,
by subverting one of the processes.
The best passive defense against an imp is known as an
imp-gate. The imp-gate is an instruction that decrements
some static location prior to the first code instruction of
the warrior. E.g:
warrior ; some attack code here
jmp warrior,<-10 ; decrement relative position -10
If an imp instruction has just been copied to position -10
when the jmp instruction is executed, it will be
decremented, meaning that the next instruction the imp
executes is not
mov 0,1, but
mov 0,0,
which does absolutely nothing, and the imp dies on the next
cycle (the core executes the next command, which is a DAT
0,0 (core is initialized to dat 0,0), which kills it).
An imp-ring is composed of multiple imps that copy each
others' instructions, by using multiple processes. This way,
if an enemy is overrun by one of the imps, it dies, since it
cannot execute the imp instruction and survive without the
help of the other imps in the ring. E.g:
one JMP imp-2666 ; jump to future imp location 1 (+1)
start SPL c ; split to the next instruction
SPL imp+2667 ; split to future imp location 2
imp MOV 0,2667 ; copy to future imp location 2
end start
The first process will (after the "
launch" (the term for
using
SPLs to initialize the ring)) execute mov 0,2667. This
moves the mov instruction to another future imp location
plus one, so that the next process can execute it.
When the next process executes it, the
MOV is copied so that
the third process won't die. If the size of core is 8000,
then the third process will keep the first one alive,
causing the ring to
crawl onwards. If an enemy warrior is
hit
with a mov 0,2667, it'll execute it and die, since there is
no process to back it up.
A spiral is a more durable type of ring. A gate-crashing
spiral is invulnerable to ordinary imp-gates.
Imps are often combined with a bomber, because imp as a
paper beats stones, and the bomber as a stone beats
scissors.