Sections
Home
Hills
Infinite Hills
Tournaments
Software
Evolving
Optimizer
Community
Newsletter
Discussion
History
Sections
 
For Beginners
First Steps
FAQ
Guides
Lexicon
Benchmarks
For Beginners
> Home > The Corewar Newsletters > Core Warrior > Issue #1

Issue 19                                                        March 4, 1996
______________________________________________________________________________
Core Warrior is a weekly newsletter promoting the game of corewar.  Emphasis
is placed on the most active hills--currently the '94 draft hill and the
beginner hill.  Coverage will follow where ever the action is.  If you have
no clue what I'm talking about then check out these five-star internet locals
for more information:

FAQs are available by anonymous FTP from rtfm.mit.edu as
pub/usenet/news.answers/games/corewar-faq.Z
FTP site is: ftp.csua.berkeley.edu /pub/corewar
Web pages are at:
http://www.stormking.com/~koth                  ;Stormking
http://www.ecst.csuchico.edu/~pizza/koth        ;Pizza
http://pauillac.inria.fr/~doligez/corewar/      ;Planar

Newbies should check the stormking page for the FAQ, language specification,
guides, and tutorials.  Post questions to rec.games.corewar.

Notice: ftp.csua.berkeley.edu is out of service, eveen is Michael
assured it will be soon OK You can download Pmars at Terry's web page:

   http://www.infi.net/~wtnewton/corewar/

______________________________________________________________________________
Greetings.

Hi,
after two weeks I'm back again to you with a new issue of
Corewarrior. I'm a bit sorry for delay, but I don't know how, Myer
managed to transmit me its intestinal disease. I heard of computer
viruses transmitted in the net, but I were thinking that Montezuma
curse were not one of them :-)

This issue we have a lot of interesting posting: Frontwards v2 by
Steven Morrell, that's now near 1000 age in 94 hill, Wayne Sheppard's
Cleaver/75, an interesting imp scanning engine, and a p-space hint
written by David Boeren, maybe the 'secret of the Octupus' can be
found here.

Many thanks to them and to anyone wishing to send us something to
publish. As I tell every time, anyone wanting to join the staff is
welcome.
______________________________________________________________________________
Current Status of the Internet Pizza Server ICWS '94 Draft Hill:

Hill Specs:
         coresize: 8000
   max. processes: 8000
         duration: after 80,000 cycles, a tie is declared.
max. entry length: 100
 minimum distance: 100
    rounds fought: 200
  instruction set: ICWS '94 Draft

Last challenge: Mon, 4 Mar 1996 06:23:37 -0800

 #  %W/ %L/ %T                      Name               Author   Score     Age
 1  43/ 31/ 26      Grilled Octopus v0.3         David Boeren     155      34
 2  44/ 36/ 20            Stepping Stone          Kurt Franke     152      30
 3  39/ 29/ 32               Tornado 3.0                Beppe     150     490
 4  41/ 35/ 24                 Chameleon           M R Bremer     146     160
 5  39/ 32/ 30                    T.N.T.    Maurizio Vittuari     146     414
 6  39/ 34/ 27               Thermite II        Robert Macrae     145     689
 7  43/ 41/ 16                      quiz              Schitzo     145    1088
 8  40/ 35/ 25                     C I A         Anders Ivner     145       1
 9  42/ 40/ 18             Frontwards v2       Steven Morrell     144     941
10  27/ 14/ 59      Hazy Shade Of Winter             John K W     141     317
11  44/ 47/ 10                  Memories          Beppe Bezzi     141      82
12  32/ 23/ 45                   Clisson              P.Kline     141      16
13  29/ 18/ 53            Impfinity v4g1               Planar     140     888
14  36/ 32/ 32                 Torch t18              P.Kline     139    1467
15  32/ 26/ 42                   Barrage        Anton Marsden     139     162
16  41/ 48/ 11                 Wild Card           M R Bremer     135     242
17  24/ 13/ 63              Evol Cap 6.6       John Wilkinson     135     703
18  39/ 44/ 17               S.E.T.I. II             John K W     134      90
19  39/ 45/ 16                Mirage 1.5        Anton Marsden     134     602
20  33/ 31/ 36           Jack in the box          Beppe Bezzi     134    1455
21  22/ 10/ 68                    Q.S.P.             John K W     133       3
22  39/ 47/ 14                   Hipshot             J E Long     131      33
23  26/ 20/ 54                  Blizzard        Anton Marsden     131     408
24  31/ 34/ 35              Breeder V3.1             J E Long     129      31
25   4/  0/  0                  test cia         Anders Ivner      12       2

Weekly age: 150 
New warriors 10  Turnover/age rate 7%
Average age: 414 ( 333 last week, 308 the week before )
Average score: 135 ( 139 last week, 139 the week before )
The 25 warriors on the hill are represented by 14
authors. Congratulation to J E Long making the 94 hill with a couple
of warriors.

Not many news this week, even if the number of challenges has been
very high. New version of the Octopus holds hilltop from its coming,
apart a very brief lead by Franke's new vampire, Stepping stone. No
other challenger did the hill in the top positions.

quiz joined the 'we have a four number age' restricted club and
Frontwards is near passing 1000 age. At present hill aging rate
Impfinity too is scheduled to pass this score for next week.

Apart the pspacers Grilled Octopus and Chameleon, and the vampire
Stepping Stone, bombers seem to be the winning strategy compared to
scanners and replicators. Qscanners too seem to have lost a little

All aged warriors hold their positions, worth noting are quiz and
Frontwards, still in the top ten.

______________________________________________________________________________
94 - What's New

 #  %W/ %L/ %T                      Name               Author   Score     Age
 1  41/ 31/ 28      Grilled Octopus v0.3         David Boeren     152       1
 3  43/ 38/ 19            Stepping Stone          Kurt Franke     149       1
 7  38/ 36/ 26                     C I A         Anders Ivner     139       1
 8  38/ 36/ 26                  test cia         Anders Ivner     139       1
12  43/ 48/ 10                  Memories          Beppe Bezzi     137       1
15  28/ 25/ 47                   Clisson              P.Kline     131       1
17  39/ 45/ 16               S.E.T.I. II             John K W     132       1
21  18/ 10/ 71                    Q.S.P.             John K W     126       1
23  36/ 52/ 12                   Hipshot             J E Long     120       1
23  29/ 35/ 35              Breeder V3.1             J E Long     124       1

Two entries in the top five: Grilled Octopus v0.3 and Stepping Stone.
______________________________________________________________________________
94 - What's No More.

 #  %W/ %L/ %T                      Name               Author   Score     Age
26  28/ 35/ 38                 patroclus       Kafka and Kurt     121     363
26   2/  1/  0                    Wraith          Kurt Franke       7     136
26  26/ 29/ 46                      Link          Kurt Franke     123     134
26   2/  2/  0      Grilled Octopus v0.2         David Boeren       5     133
26   0/  1/  3                Trade Wars              P.Kline       4      38
26   2/  1/  0                 test MT00          Beppe Bezzi       7      27
26   0/  0/  4                   Clisson              P.Kline       4      26
26   1/  1/  1                     C I A         Anders Ivner       5      26
26   0/  0/  3   Haziest Shade Of Winter             John K W       4      14
26  34/ 48/ 19                      test                   me     120       9

Patroclus is the only aged warrior to leave us.
______________________________________________________________________________
94 - What's Old

 #  %W/ %L/ %T                      Name               Author   Score     Age
14  36/ 32/ 32                 Torch t18              P.Kline     139    1467
20  33/ 31/ 36           Jack in the box          Beppe Bezzi     134    1455
 7  43/ 41/ 16                      quiz              Schitzo     145    1088
 9  42/ 40/ 18             Frontwards v2       Steven Morrell     144     941
13  29/ 18/ 53            Impfinity v4g1               Planar     140     888
17  24/ 13/ 63              Evol Cap 6.6       John Wilkinson     135     703
 6  39/ 34/ 27               Thermite II        Robert Macrae     145     689
19  39/ 45/ 16                Mirage 1.5        Anton Marsden     134     602
 3  39/ 29/ 32               Tornado 3.0                Beppe     150     490
 5  39/ 32/ 30                    T.N.T.    Maurizio Vittuari     146     414
23  26/ 20/ 54                  Blizzard        Anton Marsden     131     408
10  27/ 14/ 59      Hazy Shade Of Winter             John K W     141     317
16  41/ 48/ 11                 Wild Card           M R Bremer     135     242

quiz joined the the 1000+ exclusive club. 1500 milestone is at easy
reach for Torch and Jack.
______________________________________________________________________________
HALL OF FAME
* means the warrior is still running.

Pos    Name                  Author          Age     Strategy
 1  Torch t18              P.Kline           1467 *  Bomber
 2  Jack in the box        Beppe Bezzi       1455 *  P-warrior
 3  quiz                   Schitzo           1088 *  Scanner/ bomber
 4  Frontwards v2          Steven Morrell     941 *  One shot scanner
 5  Iron Gate 1.5          Wayne Sheppard     926    CMP scanner
 6  Agony II               Stefan Strack      912    CMP scanner
 7  Impfinity v4g1         Planar             888 *  Stone/ imp
 8  Blue Funk              Steven Morrell     869    Stone/ imp
 9  Thermite 1.0           Robert Macrae      802    Qscan -> bomber
10  Blue Funk 3            Steven Morrell     766    Stone/ imp
11  Night Train            Karl Lewin         755    Replicator
12  Evol Cap 6.6           John Wilkinson     703 *  Replicator
13  Thermite II            Robert Macrae      689 *  Bomber
14  HeremScimitar          A.Ivner,P.Kline    666    Bomber
15  La Bomba               Beppe Bezzi        650    Qscan -> replicator
16  myVamp v3.7            Paulsson           643    Vampire
17  Armory - A5            Wilkinson          609    P-warrior
18  juliet and paper       Bremer & Bezzi     607    P-warrior
19  Mirage 1.5             Anton Marsden      602 *  Scanner/ bomber
20  Phq                    Maurizio Vittuari  589    Qscan -> replicator
21  Hector 2               Kurt Franke        561    Qscan -> replicator
22  Boombastic             Maurizio Vittuari  521    Bomber
23  B-Panama X             Steven Morrell     518    Stone/ replicator
24  Tornado 3.0            Beppe Bezzi        490 *  Bomber
25  T.N.T.                 Maurizio Vittuari  414 *  Bomber

NC 94 and Cannonade leave the Hall, replaced by Tornado 3.0 and T.N.T.
The first 4 warriors in the hall are living, the 1500 milestone is now
near and 2000 too isn't that far.
______________________________________________________________________________
Current Status of the Internet Pizza Server Beginner's Hill:

Hill Specs:
         coresize: 8000
   max. processes: 8000
         duration: after 80,000 cycles, a tie is declared.
max. entry length: 100
 minimum distance: 100
      maximum age: At age 100, warriors are retired.
    rounds fought: 200
  instruction set: ICWS '94 Draft
Last challenge: Mon Mar  4 21:42:59 PST 1996 

 #  %W/ %L/ %T                      Name               Author   Score     Age
 1  56/ 33/ 11                   Hipshot             J E Long     179      27
 2  45/ 19/ 36                Breeder V3             J E Long     171      47
 3  43/ 21/ 37          Pretentious v0.2          Ian Oversby     164       2
 4  49/ 36/ 15                      Test          Ian Oversby     163       1
 5  48/ 35/ 16               Auntie v1.0          Ian Oversby     161      32
 6  45/ 30/ 24              Evil Elf V.8       Andy Nevermind     161      36
 7  37/ 14/ 49             silkworm v3.0         Brian Haskin     159      48
 8  45/ 35/ 20              Judge Nutmeg         Scott Manley     155      51
 9  37/ 25/ 38     Hyakutake C/1996 B2 +         Scott Manley     149       8
10  34/ 20/ 46          AB Scanner 2.9.4         Chris Hodson     148      62
11  41/ 38/ 22             Paralyze v0.1          Ian Oversby     144      31
12  40/ 37/ 23             Swan's Lament         Chris Arguin     142      92
13  31/ 23/ 47             RingWorm_v2.7           Calvin Loh     140      38
14  42/ 44/ 14               Maniac v0.3          Ian Oversby     139      25
15  36/ 34/ 30          Hyakutake Rising         Scott Manley     138      50
16  35/ 38/ 28    Forked Lite Ning 4.074 Ansel Greenwood Serm     132      55
17  27/ 26/ 47               XXXOOO v2.0          Joshua Houk     128      13
18  32/ 36/ 33      Pommes-Ketchup V1.32         S. Schroeder     128       3
19  32/ 37/ 31      Pommes-Ketchup V1.31         S. Schroeder     127       4
20  28/ 42/ 31             Blubbi V1i.0b       bjoern guenzel     114      58
21  32/ 50/ 18              Pensive v0.1          Ian Oversby     113      12
22  25/ 42/ 33            Test-bomb V1.5       Jens Heunemann     108      15
23  33/ 59/  8          Optma Dwarf v3.0              Phoenix     107      44
24  27/ 49/ 24          Pink Bunny V 2.1         Neil Padgett     106      52
25   4/  0/  0         El Cheapo Scanner         David Boeren      12      64

Sorry, but I haven't checked the level of the beginners hill
submitting one of my warriors. J E Long leads it, with a couple of
warriors that are in the pro hill too.
______________________________________________________________________________
The Hint
Memories

Memories is my first cmp scanner of success, having climbed, in one of
its previous versions, up to the top position. I started it as a 94
improvement of the classic Iron gate, but, tweaking here and there,
it's now like my old knife I changed three times the blade and twice
the handle but it's always my old knife. :-)

The article is a bit long, but shows how to, or better how I, work to
make a warrior. Prepare your coffee, Italian of course, and be sure to
have cigarettes for the night.

Scanners are the kind of warriors that look at core and attack it only
when they find something. They can be divided in two big subclasses,
according to the instruction they use to scan the core: cmp scanners
and jmz (most usually jmz.b) scanners.

Scanner's code is composed by three parts: scan, attack and clear. The
clear is a must because usually scanners don't kill the enemy with
their attacks but drop bombs that make it generate many processes, the
so called stun attack; so we have to kill them filling core with dats
once finished our scan routine.

Wishing to make a cmp scanner I started with Wayne Sheppard's Iron
Gate, an 88 classic scoring more than 900 age in the 94 hill too. Here
is is code:

;redcode-94
;name Iron Gate
;author Wayne Sheppard
;strategy cmp scanner-SPL/JMP-Gate

dist 	equ 73
scan 	equ dist*2     
     
     	add 	off,	@x      ;Scan block. It exits the b-field of the cmp
loc  	cmp 	dist-1,	-1      ;instruction if the lines pointed by the cmp 
     	slt 	#14,	@x      ;itself are different
     	djn 	-3,	<7000

     	mov 	j,	@loc    ;Attack block. Drops a spl 0/ jmp -1 bomb and
x    	mov 	s,	<loc    ;restore value of b-field
     	sub 	new,	@x
     	jmn 	loc,	loc-1   ;attacking loc-1 line starts the core clear

s    	spl 	#0,	<1-dist ;core clear that end in an imp gate
     	mov 	2,	<-2
j    	jmp 	-1
new  	dat 	<0-dist,<0-dist-1
off  	dat 	<scan,	<scan
end

Worth noting is the use of indirect addressing @x every time we have
to refer to label 'loc' That's because doing such way, should any of
those @x be decremented, the warrior will continue working unhindered
because the line x-1 is pointing 'loc' too

Iron Gate has been very successful in 88 and early 94, before silk
paper come in use, but now it has to be enhanced some way to compete
with newer warriors. First step was changing the bomb, from spl/jmp to
spl/spl/jmp for a better stunning of enemy (see previous number hint)
another improvement was changing the clear from backward running to
continual forward running using > addressing.
Having a jmp -2 line to be used for the bomb I added a mov in the
clear, making it faster, even if more vulnerable. Here is first
Memories version:

[header omitted]


dist    equ     229     ;not the real one
scan    equ     dist*2     
safe    equ     (kill-first+2)
stun    equ     kill+30

	jmp     s+1             ;jmp to clear if hit by djn stream
first   add     off,    @x      ;scan part is the same as Iron Gate
loc     cmp.f   dist-1, -1      ;Only removed the djn stream to keep core clean
	slt     #safe,  @x      ;mostly for lazyness :-)
	jmp     first          

	mov     j,      @loc   ;attack block drops a wider bomb
x       mov     stun,   <loc   ;notice that we are protected from increment
	mov     stun,   <loc   ;not only decrement
	sub     s,      @x
	jmn.b   loc,    loc-1  

s       spl     #-dist, <-dist-2
	mov     kill,   >first-1  ;forward running dat clear
	mov     kill,   >first-1
j       jmp     -2,     #0
off     dat     <scan,  <scan
kill    dat     <2667,  kill-first+6

for 5
	dat     0,0
rof
for MAXLENGTH-CURLINE-12
	spl     #0,#0          ;Active decoy; gain with paper lose with qscan
rof

The use of one of the spl #0 of the decoy as stun is needed to avoid
self triggering.
Memories is bigger than Iron gate and has the same speed, this is
balanced by better bombs and clear. It made the 94 hill in the top 10
positions.

Second evolution was increasing the scan speed. Being 16 lines long
with a speed of .66 c we have a size speed ratio of 24, very bad
compared with those of bombers like Tornado. Big we are, why not being
bigger but faster? adding two lines we can scan at .8 c and reduce our
size/speed ratio to 22.5 I also added a decoymaker for Frontwards
pleasure :-) Here is the enhanced version:

org     dmake

dist    equ     509
scan    equ     dist*2     
safe    equ     (last-first+1) ;decoy maker is protected
clzone	equ     (stun-first+1)
decoy   equ     -2000
dst     equ     13*4

	jmp     s+1
first   add     off,    @x      ;80%c scan engine
loc     sne.f   dist-1, -1
	add     off,    @x
	seq.f   *loc,   @loc
	slt     #safe,  @x
	jmp     first
	mov     j,      @loc
x       mov     stun,   <loc
	mov     stun,   <loc
	sub     s,      @x
	jmn.b   @x,     loc-1
s       spl     #-dist, <-dist-2
	mov     kill,   >first-1
	mov     kill,   >first-1
j       jmp     -2,     #0
off     dat     <scan,  <scan
kill    dat     <2667,  clzone

for 7
	dat     0,0
rof
stun    spl     #0,     0
for MAXLENGTH-CURLINE-12
	spl     #0,     #0
rof

dmake           ;half the decoy is reflected at dist and invisible for me
a for 11
	mov    <decoy+a*dst, <decoy+dist+a*dst
rof
last
	jmp     first
end

This version scored King, but then come Clisson and Paul's 'Spirals
and Harmony' posting. While this version is very good against 3 pts
continual imps like Night Train it's powerless against Clisson that
includes a paper imp with 7+ pts So, to keep pace I had to fit a
spiral clear in it, increasing imp killing power at expense of being
even more fragile. The clear is like the one published by JKW in SETI,
slightly modified.
Other enhancement are one more spl in the bomb, to better contrast
paper, and the use of jmn at the end of the scan loop, not to jmp if
'first' is zero. All those details added 1.5 points to total
score. The jmp to clear if decremented line is pointless now, the
spiral clear is suicidal if decremented :-(

This is Memories as is now on the hill, as you can see it doesn't look
like Iron Gate, or first Memories version anymore, but it's still the
same warrior :-)

;redcode-94
;name Memories
;author Beppe Bezzi
;strategy cmp scanner like Iron Gate
;strategy with spl spl jmp bombs and 94 improvements
;strategy v06 changed to sne/seq scan engine
;strategy v a01 spiral clear; v b* c* super clear
;strategy v d08 details
;assert 1
;kill Memories

org     dmake

dist    equ     239             :not true
scan    equ     dist*2     
safe    equ     (last-first+1)
clzone  equ     (stun-first+1)
decoy   equ     -2345           ;not true
dst     equ     13*4
ISTEP   equ     381

first   sub     off,    @x
loc     sne.f   dist-1+scan, -1+scan
	sub     off,    @x
	seq.f   *loc,   @loc
	slt     #safe,  @x
	jmn.f   first,  first
	mov     j,      @loc
x       mov     stun,   <loc
	mov     stun,   <loc
	mov     stun,   <loc
	sub     s,      @x
	jmn.b   @x,     first
	add.a   #ISTEP+1,cpt
	mov     @-1,    {cpt
j       jmp     -2,     #0
off     dat     -scan,  -scan
cpt     spl     #2,     #3
kill
s       spl     #-dist, -dist-3

for 7
	dat     0,0
rof
stun    spl     #0,     0

for MAXLENGTH-CURLINE-12
	spl     #0,     #0
rof

dmake
a for 11
	mov     {decoy+a*dst,   {decoy+dist+a*dst
rof
last
	jmp     loc
end
______________________________________________________________________________
Extra Extra
Frontwards v2 by Steven Morrell

Here is the version of Frontwards that is currently on the hill.  I think
it is the same as the code from round 8.

The differences between the first version and this one are very subtle.
First, the SPL 30 at "cc" is not a SPL #, as it was in the original.  This
avoids the logjam that can be caused trying to stun imp-rings.  It also
kills off low-process bomber/scanners immediately, so that damage to the
core-clear bombs won't hurt.  The other difference is an extra DAT round
of core-clearing.  This does well against moderately heavy imp-rings.

Here is a map around:  Most of this code is just decoy that Frontwards
doesn't detect until the second time through.  The lines from p to cc
hold the scanning pointer and the battery of bombs used for the two-pass
core-clear.  The 6 lines starting with top is the scan engine and the
core-clear engine.

An advantage of separating the data from the code is that the CMP
instruction doubles as the thing to add to p to get this to scan.  It is
hard-wired to 2*step.

;redcode-94 verbose
;name  Frontwards v2
;author  Steven Morrell
;strategy  One-shot/two-pass
;assert VERSION >= 80

step equ 12
offset equ 608  ;608
stream equ cc-1406   ;-806
first equ (cc-offset+202) ;203
gate equ -50

org boot

      stp #1,{1
for 17
      stp #1,}1
      stp.b #1,{1
      stp #1,{1
rof
      stp #1,}1

p     dat #first,{first+step
      dat #30,{-1
      dat #30,{-2
      stp.b #30,{-3
cc    spl 30,stream-660

;      stp #1,{1
;      stp #1,}1

boot  mov top+5,top+offset+5

for 5
      mov {boot,<boot
rof
boot2 mov cc,cc+offset
for 4
      mov {boot2,<boot2
rof

      jmp x+offset
      
      stp #1,{1
      mov {-1,<-1
      
;      stp.b #1,{1
      stp #1,{1
      stp #1,}1

      stp.b #1,{1
      stp #1,{1
      
top   sub x,@x
x     sne *p,@p
      djn.f top,<stream
      spl #0,<p
      mov @1,}p
      djn -1,<cc

for 6
      stp #1,}1
      stp.b #1,{1
      stp #1,{1
rof
      
end

"Steven C. Morrell" <morrell@math.utah.edu>
______________________________________________________________________________
Extra Extra
Cleaver /75 
by Wayne Sheppard


Guys,  here's the code for Cleaver/75.  I was about to post it to r.g.c
when I thought that you might want to include it in the CoreWarrior.

So everyone doesn't think I was kidding, here is how I can
scan for imps with two lines of code.  As a warning, this can't
catch 94 imps (mov #1234,2667), but it does detect 88 and diehard
imps.  This code can catch 3, 7, and 9 point imps.

3, 7, and 9 point imps all have one thing in common, they are
all evenly divisable by 127.  This has been used to make spiral
clears that can kill imps before.  But it can also be used to
detect imps.  If you MOD an instruction with DAT 127,127 the
result will be 0,0 if the instruction was a multiple of 127.
Then a simple JMZ.F to the imp routine.

I implemented this at the bottom of a bombing loop.
	ADD offset,loc
loc	MOV starta,startb
	jmz.f -2,*loc
	mod impdat,*loc
	jmn.f -4,*loc
	;impstomper starts here
 


The final version adds another indirect bomb for a total speed of
.75c.   But 19 lines of code and no paper protection makes the final
version score too low. 


;redcode-94
;name Cleaver/75
;author Wayne Sheppard
;strategy .75c bomber/scanner with active imp scan
;strategy
 
mod10 equ -70 
starta equ hit-1+mod10
startb equ starta+mod10*2
irun equ loc-15
      ;hit here
hit   mov bomb,*loc ;not in main loop, executed only when mod doesnt find imp
      mov bomb,@loc 
loc   mov starta,@startb
      sub s,loc
      jmz.f -3,*loc 	;check a-pointer
      mod i127,*loc 	;see if multiple of 127
      jmn.f hit,*loc	;if not, bomb it and continue bombing
      jmp scc       	;jump to SpiralCC
i127  dat 127,127
      dat 0 ;hit here
scc   add.x {loc,*loc	;get impnumber into A
      mov *loc,scc      ;move increment to where I can use it
      jmn.f 0,{loc      ;back up to start of imp
      mov s,*loc        ;spiral SPL
      add scc,loc
      djn -2,#400
s     spl #mod10*3,<mod10*3  ;Then CC and GATE
      mov 1,<-2
bomb  dat <mod10*3-1,mod10


wsheppar@st6000.sct.edu (Wayne Sheppard)
______________________________________________________________________________
Extra Extra
Pspace hints
by David Boeren


Hello!  This is David Boeren providing you with an extra hint this week.
Some of you have been wondering how I've managed to jump out of nowhere and
become King of the Hill, so I've decided to write an article and tell you all
about some pspace techniques that I've been experimenting with.  I hope you
all learn something, and feel free to write me if you have any questions
or ideas of how to use or improve these techniques.  Remember, the Hill is
for competition, but Core Warrior is for cooperation and sharing of ideas!

This first trick is for those of you who don't want to write switching
programs, in fact, it's mostly a trick for bombers.  Poor bombers always
get picked on for not being "smart", so perhaps these tips will help your
"dumb brute" shed that image :)

The basic idea is that you can use pspace to switch key data values in
your program to tune its performance.  Mostly, we're talking about 
changing the step size, but see below for more ideas.

I think this works best with a pspace algorithm that counts losses, 
similar to the code posted from Clisson a while ago, since a switch-on-loss
algorithm is too volatile to truly measure the change in performance.  What
you can do is run your regular bomber, and if you are losing too much, then
set a flag and permanently switch to the new step size for the rest of the
rounds.  This kind of use of pspace is not really vulnerable to brainwashing,
the worst they can do is make you switch to your other step, not make you
change to a totally different program.

Everyone who has written a bomber knows all about what a big difference 
the step size can make.  You know about find-N scores, and bombing-mods,
and all that.  Using a good step or using a bad step can make a sizable
difference in your performance.  But a "good" step isn't always good against
EVERY opponent.  Your step with a good find-23 value to whip on big scanners
is going to do poorly against smaller opponents.  So why not make a self-
tuning bomber?  A bomber that attempts to adjust itself to find a good step
vs. each opponent?

The code isn't that hard, and it depends a bit on the details of your
switching algorithm, but basically if you're using a switcher like Clisson
which tracks total performance (whether or not you use a mod-property to
detect brainwash) then you can have something like this:

        step    equ 95
        stepz   equ 184              ; "second chance" step

        SLT.B  *PRESULT,   #thresh   ; See if old step is losing...
        MOV.A    #stepz,   loop+1    ;     Try a new step

You just see if your win/loss accumulated total has slipped below a
certain threshold, and if so then you alter your bomber to a new step.
Now, this code doesn't trigger a permanent switch on its own, but it's
quite small and it WILL continue to switch the the backup step every time
the score falls below the desired performance point.  Is it better to
switch permanently?  I don't think I know yet, but I DO know that it's
riskier.  You don't want a little bad luck early in the rounds to make you
change to a worse step if you can help it.  If you want a permanent switch,
think carefully about what point to place your threshold!  Depending on your
code, it will hopefully only take one or possibly two MOVs to re-code your
bomber with the new step, so this should not cost you too much in terms of
speed.  I'd do it up front before you boot.

Altering boot distance with pspace seems more uncertain than altering
step sizes, but you can try it if you like.  Perhaps a better idea is
altering your bomb to fit the opponent.  Let's say that you have a bomber
with a 2-instruction bomb.  With only one MOV instruction, you can change
that bomb from SPL/JMP -1 for papers to STP/JMP -1 for brainwashing to
DAT/JMP -1 for a DAT bomber.  I'd recommend using this setup with the
mini-vamp technique used by warriors like Quiksand and Koolaid, which let
you drop the equivalent of three 2-instruction bombs in a loop at .5c, which
is fast and makes the "waste" for the DAT/JMP-1 bomb minimal.  Of course
don't forget to follow your bombing run up with your usual coreclear!
Did you know that any DAT bomber with a SPL/SPL/DAT coreclear can turn
into a nice paper-muncher by altering your step so that your bombing run
terminates after only one pass through the bombing loop?  Sometimes I wonder
if I ought to be telling you guys all this stuff :)

What would happen if you pswitched bombs between an anti-imp bomb and
some other bomb?  What if you did this with your paper?  Could your program
adapt to the imp-number of the opponent's spiral?  What about if your
vampire pswitched one instruction in its pit between a SPL and an STP, would
that give you better scores vs. pspacers while still letting you hit the
papers just as hard?  Try it!


The next technique is something to help protect you from brainwashers.  Some
of you probably know about this already, but I'm sure not everyone does.

Basically, there are two types of brainwashes that I know about.  One type
tries to pick up your pspace pointers and brainwash you through them.  The
other type does essentially a coreclear of your pspace, looping to overwrite
all of it with all zeros, random junk, or whatever.  I call these second types
"Brainwash Pits", even if they don't come from a Vampire.

The first type of brainwash is not dissimilar to programs that try to find
your boot pointer and attack you through it, and the defense is the same as
well.  Just be sure to erase all of your pspace pointers after using them.
Let me show you how I do this in Grilled Octopus:

sflag   DAT.F   #pdata1, #pdata2     ; pspace pointers
pflag   DAT.F   #pdata3, #pdata4     ; more pspace pointers

boot_component
        MOV.I         0,    sflag    ; Safety-net for our pspace stuff
        MOV.I         0,    pflag
boot    MOV.I   clear+1,    bdist    ; fast boot away tail first
for N
        MOV.I     {boot,    <boot
rof
        ADD.AB       #3,     boot    ; adjust to split to the correct start
        SPL.B     @boot,       #1    ; split to main program
        MOV.I         0,     boot    ; obliterate boot pointer
        DAT.F        #0,       #0    ; die

By using this type of boot routine and keeping all my pspace pointers
packed into a couple of DAT elements, I can erase my "dangerous" data
quickly.  The SPL booting method lets me split to my main program and
leave one process behind to wipe my boot pointer to protect me from
papers that like to do A-indirect bombing.  To access pspace, all I have
to do is have my LDP/STP instructions reference the sflag and pflag
instructions with the appropriate .AB type modifiers.  Although most of the
pspace code I've found in the archives always uses immediate mode to
access pspace, there is no reason why this has to be so.


I think that the whole area of dynamically recoding programs based on 
pspace performance data is very underexplored at the moment, and that 
some of you may like to try a few experiments.  Maybe you think that it's
not worthwhile, but hopefully the Hill standings will convince some of
you that I know something about pspace after all :)


Anyway, if there is interest in hearing more about pspace techniques,
then I will probably write another article soon covering inexpensive
brainwash detection, or perhaps more information on how programs which
do not use component switching can benefit from using pspace as a tuning
mechanism.  I am also considering a description of how to use multiple
pspace algorithms in conjunction with each other, such as Grilled Octopus
uses.  Please everyone feel free to email me and let me know what you think
of the ideas presented in this article and what you'd be interested in
learning more about in the future, ok?


David Boeren <akemi@netcom.com>

______________________________________________________________________________
Questions?  Concerns?  Comments?  Complaints?  Mail them to people who care:
Beppe Bezzi <bezzi@iol.it> or Myer R Bremer <bremermr@ecn.purdue.edu>
Joined the staff this week, in alfabetical order:
David Boeren <akemi@netcom.com>, Steven C. Morrell <morrell@math.utah.edu>, Wayne Sheppard <wsheppar@st6000.sct.edu>
© 2002-2005 corewar.info. Logo © C. Schmidt