He Scans Alone

47 views
Skip to first unread message

Stephen Gunnell

unread,
Oct 29, 2022, 7:16:48 PM10/29/22
to
Many years ago I was investigating the components of Recycled Bits and I pulled apart the scanner and rebuilt it to be one line shorter. The result was a JMZ scanner with a decoy generator that I called Keshin. Because an ADD.F instruction will change both the A and B fields I tried to develop a dual pointer JMN/JMZ scanner. Aoshi was never quite good enough to make the hills but not so bad that I purged the code. Around the same time I was familiar with Mini HSA from Anton Marsden's Electric Head which was a fairly unprepossessing JMZ scanner so I never investigated Paul Kline's He Scans Alone (which I guess was another fail :). Fast forward to August 2022. I had just developed some code to approximate the contents of the hill from the warriors on hand. This is a really old Idea but it needs modern processor speeds to be effective. And effective it is. One of the old warriors it highlighted was He Scans Alone. When I looked at it there was the Aoshi core but with a brilliant SNE/SUB front end that vastly improved the efficiency. So I tinkered ...

;redcode-94nop
;name He Scans Alone qhoz
;author P.Kline
;strategy 80% f-scanner switches from SPL to DAT carpet
;strategy Tweaked and upcycled by Steve G
;assert CORESIZE == 8000

STEP equ 10
TIME equ 19
OFFSET equ 2813

tPtr dat 100 ,OFFSET ; widely-spaced pointers
dat 0 ,0
for 3
dat 0 ,0
rof

tWipe mov tSpl ,<tPtr ; positive wipe of opponent
mov >tPtr ,>tPtr
jmn.f tWipe ,>tPtr

tScan sub.x #0-STEP ,tPtr ; increment and look
sne *tPtr ,@tPtr
sub.x *pScan ,@tScan ; increment and look
jmn.f tSelf ,@tPtr
jmz.f tScan ,*tPtr
pScan mov.x @tScan ,@tScan ; swap pointers for attack
tSelf slt.b @tScan ,#tEnd+4-tPtr ; self-check
djn tWipe ,@tScan ; go to attack
djn *pScan ,#TIME ; after 19 self-scans
jmp *pScan ,}tWipe ; switch to dat-wiping
dat 0 ,0
tSpl spl #1 ,{1
dat 0 ,0
dat 0 ,0
tEnd dat 0 ,0

for MAXLENGTH-CURLINE-2-1
dat 0 ,0
rof

;tDecoy equ (tWipe+7007)
;tStart mov <tDecoy+0 ,{tDecoy+2 ; make a quick-decoy
; mov <tDecoy+3 ,{tDecoy+5 ; to foil one-shots
; mov <tDecoy+6 ,{tDecoy+8 ; and the occasional q-scan
; djn.f tScan+1 ,<tDecoy+10

B equ (tWipe+7007)

tStart mov.i <B ,{B+3
I for 1
mov.i <B+1+(3*I) ,{(B+(3*I)+3)
rof
djn.f tScan+1 ,<B+5+(3*1)

end tStart

Stephen Gunnell

unread,
Oct 29, 2022, 10:08:22 PM10/29/22
to
On Sunday, 30 October 2022 at 7:16:48 am UTC+8, Stephen Gunnell wrote:

> ;name He Scans Alone qhoz
> tScan sub.x #0-STEP ,tPtr ; increment and look

It is probably worth noting that I kept STEP as a fairly small value as did Paul in his original code ( the optimiser selected 10/8 in qhoz and the original was 12/9 ). During the development of Aoshi I also noted that using different steps for the A and B fields was very effective. I also note that a mod 10 step seems to also be a value that my Hazy Lazy scanners gravitate towards. If you set STEP to be a large mod 10 value the A field may efficiently scan the core and when it found something it would pass the value to the B field which would scan forwards in small increments.

Steve

John Metcalf

unread,
Nov 6, 2022, 1:35:22 PM11/6/22
to
Congrats, impressive score on 94nop :-) I'd be interested to compare
which warriors your code selected with those in my hand-picked benchmark.

There are a few tweaks in some other HSA-style scanners which might be
worth trying:

Seven-Eleven (.8c, steps 7/11), DAT 0, {0 for the dat-wipe

Razor (.66c, steps 7/9), perfect gate, SNE.I scanner

Willow (.66c, steps 13/9), DAT >0, 0 for the dat-wipe

Ash (.8c, steps 17/11), use SNE.X and alternates between SUB.F and SUB.X

Trouble (.8c, steps 11/16), start scan at 3rd instruction after self-scan

Here's the code for Trouble:

;redcode-94nop
;name Trouble
;author John Metcalf
;strategy scanner
;assert CORESIZE==8000

x equ 3100
y equ 600
stepx equ 11
stepy equ 16
count equ 16

ptr dat y, x+y-1

for stepx-8
dat 0, 0
rof

dat >0, 0
sb spl #0, {0

wipe mov @bp, <ptr
mov >ptr, >ptr
jmn.f wipe, >ptr

scan sub.x inc, ptr
sne.x @ptr, *ptr
inc sub.x #-stepy, ptr
jmn.f hit, @ptr
jmz.f scan, *ptr

mov.x @scan, @scan
hit slt.b @scan, #last+2-ptr
djn.f wipe, ptr
djn inc, #count
bp djn.f inc, #sb

last end scan+1

Stephen Gunnell

unread,
Nov 6, 2022, 5:50:41 PM11/6/22
to
On Monday, 7 November 2022 at 2:35:22 am UTC+8, John Metcalf wrote:

> Congrats, impressive score on 94nop :-) I'd be interested to compare
> which warriors your code selected with those in my hand-picked benchmark.
>
The current list is:
Starting WarriorZ ... lore2.red - 0.963639104067866
Starting Her IMPertinent Majesty ... yellownewspaper.red - 0.968492684024264
Starting Visigoth ... sharky.red - 0.97160387599864
Starting biSHO ... k310.red - 0.971778549072255
Starting ShadowWeaver ... borgir.red - 0.969684633279653
Starting dreadful cross ... lastjudgement.red - 0.977390396931096
Starting AshII ... hsaopt-qhoh.red - 0.979644545493337
Starting Resinoid ... lordimprings2.red - 0.963729691567763
Starting King Cobra ... twilight.red - 0.935340724763019
Starting Tolyputes ... blowrag2.red - 0.966682391867335
Starting Despair ... borgir.red - 0.970876224369984
Starting Pocket Rocket ... zplusplus.red - 0.929591489465872
Starting Electra ... lordimprings2.red - 0.974757202343255
Starting Monster Human Grunt ... elvenking2.red - 0.975380831472071
Starting incubus ... hullabaloo3.red - 0.969622420270168

The number at the end is the correlation coefficient between the selected proxy warrior's scores and the scores of the real warrior.

Here is the corresponding list for 94x:
Starting DriedFrogPillsAX9 ... dfpopt-qreo.red - 0.988565232237808
Starting PuddleglumX ... puddleglum-xjcl.red - 0.99928754183971
Starting paperX ... grimoireA-ugbc.red - 0.991370859383051
Starting DriedFrogPillsAX133 ... dfpopt-nxac.red - 0.995470490449125
Starting Morlock ... deadletter-xlwm.red - 0.931948655588622
Starting PendulumX ... memories07x.red - 0.932070614564449
Starting BlackMoods ... dflyoptB-prrt.red - 0.887106456201055
Starting Slayer ... mavinopt1-dtat.red - 0.93102766140238
Starting DespairX ... deadletter-tiru.red - 0.98989167508046

I left PuddleglumX floating as a sanity check and the program has correctly found the correct version. For the two copies of Dried Frog Pills the originals were deleted and I let the program select stand ins.
As you can see with Black Moods I have no good approximations in my repertoire.

I'm happy to publish the code if people are interested but it is in Perl.

Steve

Stephen Gunnell

unread,
Nov 8, 2022, 10:55:25 PM11/8/22
to
On Monday, 7 November 2022 at 6:50:41 am UTC+8, Stephen Gunnell wrote:

> Starting Resinoid ... lordimprings2.red - 0.963729691567763
> Starting Electra ... lordimprings2.red - 0.974757202343255

I got annoyed at multiple unknown warriors mapping to the same proxy so I added code to allow unknown warriors to differentiate from each other.
94nop is now:
Starting Monster Human Grunt ... elvenking2.red - 0.975380831472071
Starting biSHO ... k310.red - 0.971778549072255
Starting incubus ... spiritual.red - 0.970529104184943
Starting Despair ... borgir.red - 0.970876224369984
Starting WarriorZ ... lore2.red - 0.951270800865769
Starting Resinoid ... unheardof.red - 0.954543201503372
Starting dreadful cross ... lastjudgement.red - 0.977390396931095
Starting Pocket Rocket ... zplusplus.red - 0.929591489465872
Starting King Cobra ... twilight.red - 0.935340724763019
Starting Her IMPertinent Majesty ... yellownewspaper.red - 0.968492684024264
Starting Electra ... lordimprings2.red - 0.980289980569215
Starting Visigoth ... sharky.red - 0.97160387599864
Starting Tolyputes ... blowrag2.red - 0.966682391867335
Starting ShadowWeaver ... borgir.red - 0.969684633279653

Mind you, I'm struggling to keep up with all John's submissions and it isn't helping that messages from the hill are randomly dissapearing.

Steve

John Metcalf

unread,
Nov 21, 2022, 9:02:15 AM11/21/22
to
I'd be interested :-) It appears to be doing a good job of matching the
warriors to a proxy.

John
Reply all
Reply to author
Forward
0 new messages