;redcode
;name ChainSawV6
;author Skybuck Flying
;strategy like a linked list
;version 6
;date 9 february 2008
;
; V6 is my best and first attempt at a chainsaw idea, conclusion so far:
;
; Concept seems to be bad, at least for serial threaded corewar, process
in
between don't do anything and just waste cycles
; also using a single instruction to detect good vs bad copy is bad.
; The keep alive flag works much better, bit more complex but ok.
;
Initialization
mov.a WarriorCopySource, WarriorCopySourceReset
jmp CheckHeart
WarriorBegin
WarriorLength equ WarriorEnd - WarriorBegin
; we can just switch here... cool.
Switch
; swap reset destinations
mov.x WarriorCopyDestReset, WarriorCopyDestReset
; swap heart check destinations
mul.ab #-1, CheckHeart
; swap jump positions
mov.x WarriorJump, WarriorJump
; if the $555 is already there then don't copy it wow nice.
; skip over next instruction if heart not present this will result in a
copy
; otherwise switch and check other heart etc.
CheckHeart
sne.a #555, $WarriorLength
jmp Switch
; Reset source
mov.a WarriorCopySourceReset, WarriorCopySource
mov.b WarriorCopyDestReset, WarriorCopyDest
; Reset length
mov.ab #WarriorLength, WarriorCopyLoop
; Copy instruction
WarriorCopy mov }WarriorCopySource, >WarriorCopyDest
; Loop
WarriorCopyLoop djn WarriorCopy, #WarriorLength
; first start with a warrior which copies itself to the back
; and then to the front... makes it easier to get the offsets
; correctly i think..
WarriorJump spl WarriorEnd, WarriorBegin - 15
jmp WarriorBegin
WarriorData
; Variables
WarriorCopySource
WarriorCopyDest
nop $WarriorBegin, $WarriorEnd
; Reset variables
WarriorCopyDestReset
WarriorCopyDestForPrevReset
WarriorCopyDestForNextReset ; -15 needs to be replaced manually
with -warriorlength
nop $(WarriorEnd-WarriorCopySource) - 15 * 2,
$WarriorEnd-WarriorCopySource
WarriorCopySourceReset
nop $0, $0
WarriorEnd


|