On Monday, 21 February 2022 at 7:13:32 am UTC+8,
[email protected] wrote:
After experimenting a lot with quick scanners I had this crazy idea:
What if we could combine the speed of a qscan with for example a oneshot?
Sometimes it's refreshing to tinker around with new strategies and this is one I've tried before. Based on other failed attempts I didn't think it was possible. In the end however I managed to create something that works well enough to possibly be
competative after more iterations.
To get this high scanning speed we need to create a table with all the positions that we want to have scanned. Like this:
n for 79
dat zero - (47*n) , zero + 50 + (49*n)
rof
Now we can scan using this cute tiny 1C scanner:
wPtr sne.i *tableEnd , @tableEnd
djn.f {0 , }0
When we find something, we translate back the position:
add.f *wPtr , wPtr ; move pointer over for clear
jmz.f clear , *wPtr ; jump if A-field is zero
mov.x wPtr , wPtr ; swap A - B, we attack B
jmp clear
Obviously the table is a giant target for scanners and quick scanners, so we quickly boot away our code and turn it all into a decoy. It has a rather limited scan run of course, just 79*2 = 158 positions. One is actually a self-scan to activate the
clear in a better spot. Including boot it just takes 166 cycles to accomplish this, approaching hyperspeed 1C.
I'm not able to make it work well enough for a hill, but the idea is there and it scores about the same as other oneshots I've created.
It might be very benificial to have other ordering in the table or use mixed stepsizes, you're free to pick whatever numbers you like, where you like. I haven't dared to put it into an optimizer to tweak all 158 values.
Another idea I'd like to try is skipping "the compare and swap" and do a bi-clear style clear on both A/B fields at the same time... if anybody tries this let me know!
What do you think?
Here is the code:
;redcode-94nop
;name Hyperscan
;author Roy van Rijn
;strategy Rethinking what a qscan can be
;strategy Scans 158 positions in 166 cycles
;assert 1
zero equ wGo-100
bDist equ 4011
bPtr equ wPtr + bDist
; Big table with scan pointers, do whatever you like here:
n for 79
dat zero - (47*n) , zero + 50 + (49*n)
rof
; Boot the code using least possible lines:
wGo mov.i wPtr + 8 , bPtr + 10
mov.i wPtr + 7 , bPtr + 9
mov.i wPtr + 7 , bPtr + 8
mov.i wPtr + 6 , bPtr + 7
add.b wPtr + 6 , } bPtr + 6
mov.i wPtr + 5 , bPtr + 5
mov.i wPtr + 4 , bPtr + 4
mov.i wPtr + 3 , bPtr + 3
mov.i wPtr + 2 , bPtr + 2
mov.i wPtr + 1 , bPtr + 1
mov.i wPtr , bPtr
boot djn.f bPtr , bPtr + 9
; small scanner
wPtr sne.i *wGo-1-bDist , @wGo-1-bDist
djn.f {0 , }0
; set up the clear:
add.f *-2 , *0 ; move pointer over for clear
jmz.f 4 , *wPtr ; compare and
mov.x wPtr , wPtr ; swap
djn.b 2 , wPtr ; jump to clear and decrement scan
; simple SD clear:
; dat 1 , 13 ;generated by boot
spl #224 , 13
mov *-2 , >-8
; mov *-3 , >ptr ;generated by boot
djn.f -2 , }-3
end wGo
It is probably scans for too long as it stands. I threw it against my 94nop hill and it came in a fair way down.
stimpy2.red 124.65 173 by Brant D. Thomsen / Stimpy v2.0
geraldton-nlkl.red 124.43 174 by Steve Gunnell / Geraldton A nlkl
dugiteD-ptsp.red 123.91 175 by Steve Gunnell / Dugite D ptsp
hyperscan.red 123.36 176 by Roy van Rijn / Hyperscan
creakyoldcode.red 122.96 177 by John Metcalf / Creaky old code
drrecover.red 122.63 178 by Franz / Dr. Recover
anlss.red 122.43 179 by RNNredgen / anlss
While I was working on round 4 of Christian's recent tournament I bumped into T-Scan and Afterglow where John M does something similar but I hadn't followed them up yet.
But it is probably worth adding to a strong-ish warrior to see if there is an advantage to be had. Does Ziggy have a Qscan? Starlink has been sitting high enough on my hill that I thought it might be a valid upcycling candidate - it might be worth a try.
Cheers,
Steveg
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)