Subject: Example Redcode Program From: blojo@xcf.berkeley.edu (Jon Blow) Organization: WINDOM BIFF FAN CLUB!!!!!!!!!!!! Date: 15 Nov 91 01:34:34 GMT Message-ID: This program is the most successful application of SPL0 that I have conjured up. A brief description of how it works: MARS FLYTRAP picks an address to bomb; it then calculates the distance between that address and the target location 'maw'. It calculates a jump instruction that leads to 'maw' and then drops that instruction in the bomb slot. The 'maw' address is, of course, yet another incarnation of SPL0. The FLYTRAP then copies itself up the core and continues. Each time it copies itself, it drops a zero-bomb five lengths behind itself-- where it was before it jumped five times. This zero bomb will land in a maw five generations old, causing all processes looping inside it to die. The basic idea at work here is that the MARS FLYTRAP attempts to keep processes occupied by having them spawn indefinitely, but it eventually kills the enemy off. Since there is more than one maw active (hopefully) at once, when one of them is destroyed, the processes inside the other ones will replicate enough to once again fill the process limit, if there is at least one process in some maw. If there is no process limit, then, well, we don't have to worry about the enemy getting too much faster when we destroy a maw because they will have spent more of their time splitting than they would were they to run into a process limit and fail to split. This program was written in Redcode '86 and translated into '88. If it used the full features of '88, it could probably be written more efficiently. Note also the arithmetic acrobatics it performs to compute the jump bomb; this is because the simulator I wrote this on adds all 3 numerical slots of an address (INSTRUCTION, A, and B) when executing ADD and SUB operands. I believe that the new standard says that only the data field (B) should be affected, which would also make this program simpler. ;;; MARS FLYTRAP ;;; ;;; Performs somewhat well against MICE. ;;; Makes pretty patterns versus CHANG1. ;;; ;;; - blojo@soda.berkeley.edu safety equ 64 ; So we don't hit ourselves step equ 16 ; Distance between bomb targets jumpd equ 813 ; How far we jump per step len equ last - index ; Length of the necessary program start sub jmpmsk, delta jmp loop jmpmsk jmp 0 bomb jmp maw ; This is the expendable part of the flytrap, target dat #-1 ; which we do not need to copy, and so we index dat 0 ; don't. delta jmp 16 orgjmp jmp maw-bomb ; dist. from BOMB to MAW mov #-1, target ; must be = to target's initial value mov orgjmp, bomb loop sub #step, target add delta, bomb mov bomb, @target slt target, #safety jmp loop mov #len, index mov #-jumpd, target cploop mov @index,