Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Sneaky B2 - A Self-Replicating Stone/Scanner

141 views
Skip to first unread message

fizmo

unread,
Apr 29, 2013, 5:51:10 AM4/29/13
to
Hi all,

I would like to share the code of Sneaky B2 with you.

The self-replicating part of the code is typically found in paper warriors on the Low-Process (LP) hill.

The major difference is, that Sneaky B2 starts first with a bomb/scan loop of this type:

sGo add.f sTab, sScan
sScan mov.i }sOff1, sOff2
jmz.f -2, {sScan

If it founds something it dat-wipe the scanned location and at the same time it replicate itself to another location:

mov.i sTab, }sScan
mov <sStart, {to
jmn -2, sStart

at the end it starts the replicated code and also continue bomb/scan the core:

spl >sStart, }-200
to jmz sAwa, *0

That means in the beginning of the battle Sneaky B2 behaves much like a dwarf warrior. Whereas during the battle, when the core becomes more colored the self-replication/dat-wiping becomes predominant.

Sneaky B2 shows good scores against most scanner types with weaknesses against some oneshots. Also the scores against paper warriors and stone/imps are usually good. But it is vulnerable against stone/imps that use spl-bombs. That's why I believe that Monster_Human_Grunt and Monster_Alien_Grunt on the 94nop hill are such type of stone/imps ;-)

Here are the scores against optimax fsh94nop0.3 benchmark:

Type %W %L %T pts
------------------------------
cds: 47.6 44.5 7.9 150.7
clr: 33.7 57.3 9.0 110.1
scn: 51.8 46.3 1.9 157.2
pap: 30.8 22.2 47.0 139.4
pwi: 13.2 17.7 69.1 108.6
pws: 31.1 25.7 43.2 136.5
sai: 24.8 31.2 44.0 118.4
sbi: 25.5 27.9 46.6 123.1
stn: 42.0 51.8 6.2 132.3

The scores show, that Sneaky B2 is a surprisingly good allround warrior. I think it has potential for further improvements.

Sneaky B2 is currently 14th on the 94draft hill and appeared already on the 94nop and 94x hills.

Ok, without further ado here's Sneaky B2:


;redcode-94
;author Christian Schmidt
;name Sneaky B2
;strategy Self-Replicating Stone/scanner
;assert 1

;------------ Qscan Constant ---------------

zero equ qbomb
qtab3 equ qbomb
qz equ 2108
qy equ 243

qc2 equ ((1 + (qtab3-qptr)*qy) % CORESIZE)
qb1 equ ((1 + (qtab2-1-qptr)*qy) % CORESIZE)
qb2 equ ((1 + (qtab2-qptr)*qy) % CORESIZE)
qb3 equ ((1 + (qtab2+1-qptr)*qy) % CORESIZE)
qa1 equ ((1 + (qtab1-1-qptr)*qy) % CORESIZE)
qa2 equ ((1 + (qtab1-qptr)*qy) % CORESIZE)

qoff equ -88
qstep equ -7
qtime equ 20

;-------Constants for optimization----------

sLen equ 21
sOff1 equ 219
sOff2 equ 7771
sStep1 equ 3431
sStep2 equ 3916
sAwa equ 2543

pAwa equ 5895

;-------------------------------------------

dat 0, 0
qbomb dat >qoff, >qc2

;------ 45 instructions --------------------

pGo spl 1 , 0

for 5
mov.i <sTab+1, {pBoot
rof
pBoot djn zero+pAwa, #1


dat 0, 0
dat 0, 0
dat 0, 0

sStart mov #sLen, #sLen
sGo add.f sTab, sScan
sScan mov.i }sOff1, sOff2
jmz.f -2, {sScan
mov.i sTab, }sScan
mov <sStart, {to
jmn -2, sStart
spl >sStart, }-200
to jmz sAwa, *0
sTab dat <sStep1, >sStep2


for 25
dat 0, 0
rof

;-------------------------------------------

dat 0, <qb1
qtab2 dat 0, <qb2
dat 0, <qb3


dat 0, 0
dat 0, 0
dat 0, 0
dat 0, 0

dat zero-1, qa1
qtab1 dat zero-1, qa2

dat 0, 0
dat 0, 0
dat 0, 0
dat 0, 0
dat 0, 0


qgo sne qptr+qz*qc2, qptr+qz*qc2+qb2
seq <qtab3, qptr+qz*(qc2-1)+qb2
jmp q0, }q0
sne qptr+qz*qa2, qptr + qz*qa2 + qb2
seq <qtab1, qptr+qz*(qa2-1)+qb2
jmp q0, {q0
sne qptr+qz*qa1, qptr+qz*qa1+qb2
seq <(qtab1-1), qptr+qz*(qa1-1)+qb2
djn.a q0, {q0
sne qptr+qz*qb3, qptr+qz*qb3+qb3
seq <(qtab2+1), qptr+qz*(qb3-1)+(qb3-1)
jmp q0, }q1
sne qptr+qz*qb1, qptr+qz*qb1+qb1
seq <(qtab2-1), qptr+qz*(qb1-1)+(qb1-1)
jmp q0, {q1
sne qptr+qz*qb2, qptr+qz*qb2+qb2
seq <qtab2, qptr+qz*(qb2-1)+(qb2-1)
jmp q0, }4443 ;extra attack
seq >qptr, qptr+qz+(qb2-1)
jmp q2, <qptr
seq qptr+(qz+1)*(qc2-1),qptr+(qz+1)*(qc2-1)+(qb2-1)
jmp q0, }q0
seq qptr+(qz+1)*(qa2-1),qptr+(qz+1)*(qa2-1)+(qb2-1)
jmp q0, {q0
seq qptr+(qz+1)*(qa1-1),qptr+(qz+1)*(qa1-1)+(qb2-1)
djn.a q0, {q0
jmz.f pGo, qptr+(qz+1)*(qb2-1)+(qb2-1)

q0 mul.b *2, qptr
q2 sne {qtab1, @qptr
q1 add.b qtab2, qptr
mov qtab3, @qptr
qptr mov qbomb, }qz
sub #qstep, qptr
djn -3, #qtime
jmp pGo, }3256 ;extra attack

dat 0, 0
dat 0, 0
dat 0, 0
dat 0, 0

end qgo

pauld...@aol.com

unread,
Apr 29, 2013, 9:58:27 AM4/29/13
to
On Monday, April 29, 2013 4:51:10 AM UTC-5, fizmo wrote:
> Hi all, I would like to share the code of Sneaky B2 with you.

Clever! Small and versatile, I don't remember seeing anything quite like it.
Kind of a bombing mice, with emphasis on the bombing.

P. Kline

John Metcalf

unread,
May 13, 2013, 2:42:43 PM5/13/13
to
Hi,

I wondered how Sneaky would score with an anti-imp bomb so I added one, creating Sneaky Tweaky. It scored 8.7 points higher than pure Sneaky on '94nop and survived 90 challenges (due to artificial ageing caused by all those anonymous tests).

Here's the code for Sneaky Tweaky - Christian's hard work with a small tweak by me :-)

John

;redcode-94nop
;name Sneaky Tweaky
;author Schmidt/Metcalf
;strategy Self-Replicating Stone/scanner
;assert CORESIZE == 8000

sLen equ 21
sOff1 equ 219+sStep1
sOff2 equ 7771+sStep2
sStep1 equ 3431
sStep2 equ 3916
sAwa equ 2543

pAwa equ 5895


sStart mov #sLen, #sLen
sGo add.f sTab, sScan
sScan mov.i }sOff1, sOff2
jmz.f -2, {sScan
mov.i iBmb, }sScan
mov <sStart, {to
jmn -2, sStart
spl >sStart, }-200
to jmz sAwa, *0
sTab dat <sStep1, >sStep2
iBmb dat <2667, <5334

end sScan

Skybuck Flying

unread,
May 14, 2013, 10:58:20 PM5/14/13
to
Seeing this warrior in action give me a potentially/somewhat new idea
because at first I thought it did something new but it didn't.

But here is the new idea which might be worth investigating:

1. Take the code of a paper/self-replicating warrior.

2. Instead of:

// typical replicator/paper:
Step 1 Copy code.
Step 2 Spawn at copy of code/bring it alive.
Step 3 Repeat 1

The new idea is:

// new type/kind of replicator/paper:
Step 1 Copy code.
Step 2 Repeat 1

Step 3 Spawn code
Step 4 Repeat 3

The idea for the new replicator is:

1. Make copies of code real fast with a single process, hopefully
outperforming classic papers, for example classic papers execute the spawn
instruction which is at least
one additional instruction.

2. Activate multiple copies of oneself in the core all at once with
hopefully faster spawning code, maybe something special can be done to
create the many spawn threads, for example a binary spawner, 1,2,4,8,16
copies of the spawn threads and then use jump table to jump to spawn
locations.

Then again, this new idea is probably slower, and more vunerable... never
the less I will post it anyway ;) :)

Bye,
Skybuck.






fizmo

unread,
May 16, 2013, 10:54:36 AM5/16/13
to
Am Mittwoch, 15. Mai 2013 04:58:20 UTC+2 schrieb Skybuck Flying:

> The new idea is:
>
> // new type/kind of replicator/paper:
> Step 1 Copy code.
> Step 2 Repeat 1
>
> Step 3 Spawn code
> Step 4 Repeat 3
>
> The idea for the new replicator is:
>
> 1. Make copies of code real fast with a single process, hopefully
> outperforming classic papers, for example classic papers execute the spawn
> instruction which is at least
> one additional instruction.

> 2. Activate multiple copies of oneself in the core all at once with
> hopefully faster spawning code, maybe something special can be done to
> create the many spawn threads, for example a binary spawner, 1,2,4,8,16
> copies of the spawn threads and then use jump table to jump to spawn
> locations.
>
> Then again, this new idea is probably slower, and more vunerable... never
>
> the less I will post it anyway ;) :)

Also think of separating the code for the copying and spawning.

Or you could use a single source to do all the copy and spawn tasks in the core. A kind of looped bootstrapper which boots the code again and again. I used that in my "Utterer" warrior series (see code example below).

While I'm writing this I'm wondering how a warrior would score if the imp-launcher would be booted only once or twice. I think I should give it a try later...

dDst dat #sBoo, #iBoo

pGo spl 1, }6196
spl 1, }7391

sCpy mov.i <sSrc, {dAwa
sAwa spl *dAwa, >sSrc
iCpy mov.i <iSrc, <dAwa
iAwa spl @dAwa, >iSrc
add.f dDst, dAwa
djn.f sCpy, <1591

dAwa dat #sDst, #iDst

for 5
dat 0, 0
rof

spl #sStep1, >sStep2
mov {sStep3, {sStep4
add -2, -1
pEnd djn.f @0, {-2
sSrc dat 0, 0

for 18
dat 0, 0
rof


iStart spl #iStep, <iBmb
add.f iStart, launch
launch djn.f imp-iStep-1, <iBmb2
imp mov.i #iStep, *0
iSrc dat 0, 0

fizmo

unread,
May 21, 2013, 7:02:26 AM5/21/13
to
Just a small update.

Sneaky B2 entered the Koenigstuhl Infinite Hills as:

174th the Recursive 94nop-Koenigstuhl
154th the Recursive 94draft-Koenigstuhl
28th the Recursive LP-Koenigstuhl

P. Kline

unread,
May 28, 2013, 8:48:41 AM5/28/13
to
On Apr 29, 4:51 am, fizmo <fizmo_mas...@yahoo.com> wrote:
> Hi all,
>
> I would like to share the code of Sneaky B2 with you.

Maybe a CIA bomber would be effective, triggering replication after
killing one enemy process. Or a vampire that goes to paper after
capturing one.

P. Kline
0 new messages