;redcode
;name SpiralV1
;author Skybuck Flying
;strategy spiral bombing around itself just for fun
;version 1
;date 20 february 2008
;left upper corner is bombed twice but that s ok
LineSize equ 128
WarriorBegin
WarriorLength equ WarriorEnd - WarriorBegin
; place one bomb at the back, then go up
mov Bomb, @[EMAIL PROTECTED]
; increment bomb position vertically with one
sub.ab #LineSize, BombPosition
Repeat
; add two to bombing length
add.ab #2, $HorizontalBombingLength
; copy HorizontalBombingLength to loop
mov.b $HorizontalBombingLength, $WarriorBombUpperLineRepeat
; then bomb upper line
WarriorBombUpperLineBegin
WarriorBombUpperLinePlaceBomb
mov Bomb, >BombPosition
WarriorBombUpperLineRepeat
djn WarriorBombUpperLinePlaceBomb, #0
WarriorBombUpperLineEnd
; then bomb vertical line right
; subtract one from bombing position
sub.ab #1, $BombPosition
; add one to vertical bombing length
add.ab #1, $VerticalBombingLength
; copy vertical bombing length to loop
mov.b $VerticalBombingLength, $WarriorBombRightLineRepeat
WarriorBombRightLineBegin
WarriorBombRightLineGoDown
add.ab #LineSize, BombPosition
WarriorBombRightLinePlaceBomb
mov Bomb, @[EMAIL PROTECTED]
WarriorBombRightLineRepeat
djn WarriorBombRightLineGoDown, #0
WarriorBombRightLineEnd
; then bomb bottom line
; copy HorizontalBombingLength to loop
mov.b $HorizontalBombingLength, $WarriorBombBottomLineRepeat
; then bomb upper line
WarriorBombBottomLineBegin
WarriorBombBottomLinePlaceBomb
mov Bomb, <BombPosition
WarriorBombBottomLineRepeat
djn WarriorBombBottomLinePlaceBomb, #0
WarriorBombBottomLineEnd
; then bomb vertical line left
; add one to vertical bombing length
add.ab #1, $VerticalBombingLength
; copy vertical bombing length to loop
mov.b $VerticalBombingLength, $WarriorBombLeftLineRepeat
WarriorBombLeftLineBegin
WarriorBombLeftLineGoUp
sub.ab #LineSize, BombPosition
WarriorBombLeftLinePlaceBomb
mov Bomb, @[EMAIL PROTECTED]
WarriorBombLeftLineRepeat
djn WarriorBombLeftLineGoUp, #0
WarriorBombLeftLineEnd
; repeat
jmp Repeat
WarriorData
Bomb dat $0, $0
BombPosition dat $0, $WarriorBegin-1
HorizontalBombingLength dat $0, #WarriorLength
VerticalBombingLength dat $0, #1
WarriorEnd


|