This reviver is very simple.
It tells the program to run once.
The program waits until it's told to run.
When the program is done running once it reset the run to zero.
Then the reviver waits and checks if it was zero.
If it was not zero the program did not complete and the reviver knows the
program died.
So it spawns a new thread to run the program !
So simple !
The fixer takes care of fixing the instructions !
Nice and simple !
Could be further optimized to make programs shorter.
Only problem now is:
1. Who gonna fix the reviver ?
2. Who gonna revive the reviver ?
Another copy might have to do that... or some robustness or something.
;redcode
;name FixerV2
;author Skybuck Flying
;strategy threads-serialized-fixer. One thread per instruction.
;version 2
;date 21 december 2007
; pretty cool could come in handy to fix stuns quite fast
spl Program
spl ReviveProgramBegin
spl 1 ; 2
spl 1 ; 4
spl 1 ; 8
spl 1 ; 16
jmp ScanIt
; New idea: use a jmx combo with mov from other warrior or so.
ReviveProgramBegin
RunIt
; tell program to run
mov.ab #1, Run
mov.ab #17, wait
; wait
wait djn 0, #20
; if program is done then run again
jmz RunIt, Run
; else program died, respawn
spl Program
; jmp to run it
jmp RunIt
; or just build in double robustness.
ReviveProgramEnd
ScanIt
mov.ab #1, ThreadCounter
jmz.f DoFixIt, >ThreadCounter
DontFixIt
mov.ab #1, ThreadCounter
nop $0, >ThreadCounter
jmp ScanIt
DoFixIt
mov.ab #1, ThreadCounter
mov Fix, >ThreadCounter
jmp ScanIt
Fix nop $777
ThreadCounter dat $0, $1
Run dat $0, $0
Program
jmz 0, Run
nop 1
nop 2
nop 3
nop 4
nop 5
nop 6
nop 7
nop 8
nop 9
nop 10
nop 11
nop 12
nop 13
nop 14
nop 15
nop 16
mov #0, Run
jmp Program
>> Stay informed about: Concept: FixedV2 (with very simple reviver ! ;) :))