;redcode
;name ChainSawV7
;author Skybuck Flying
;strategy like a linked list
;version 7
;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.
;
;
; Ok V7 has a bomber added that has a better chance of surviving by simply
killing
; the enemy... the second instruction needs to be altered for bigger cores
or so
; Some better formula has to be found :)
;
; kinda interesting bombing pattern. Looks a little bit like a chainsaw
too
lol.
Initialization
mov.a WarriorCopySource, WarriorCopySourceReset
stp.ab #CORESIZE/16, #10
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.
; let's add some bombing code to do something usefull in this spinning
; stuff
; let's use p-space to have some kind of common space to increment?
ldp.ab #10, Bomber
add.ab #10, Bomber
Bomber mov (CORESIZE/2)-1, 0
stp Bomber, #10
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 - 19
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) - 19 * 2,
$WarriorEnd-WarriorCopySource
WarriorCopySourceReset
nop $0, $0
WarriorEnd


|