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 20                                                       March 11, 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.  All new players
are infinitely welcome!

If ftp.csua.berkeley.edu is still out of service, you can download Pmars at
Terry's web page--http://www.infi.net/~wtnewton/corewar/
______________________________________________________________________________
Greetings.

Sorry for the delay--what's new with my irresponsability?  Give me a break,
I'm just a kid!  Kurt Franke is kind enough to provide us with the hint this
week.  Thanks goes out to everyone who has contributed to Core Warrior.  

--M R Bremer
______________________________________________________________________________
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

 #  %W/ %L/ %T                      Name               Author   Score     Age
 1  45/ 32/ 23      Grilled Octopus v0.5         David Boeren     158      19
 2  44/ 35/ 21            Stepping Stone          Kurt Franke     152     144
 3  39/ 31/ 30               Tornado 3.0                Beppe     148     604
 4  43/ 40/ 16                      quiz              Schitzo     146    1202
 5  40/ 34/ 26                 Chameleon           M R Bremer     146     274
 6  40/ 34/ 26               Thermite II        Robert Macrae     145     803
 7  36/ 28/ 36                   Barrage        Anton Marsden     144     276
 8  42/ 41/ 17             Frontwards v2       Steven Morrell     143    1055
 9  42/ 42/ 16                     C I A         Anders Ivner     143      62
10  44/ 45/ 11                  Memories          Beppe Bezzi     142     196
11  29/ 16/ 55      Hazy Shade Of Winter             John K W     142     431
12  43/ 44/ 14                Hipshot V2             J E Long     142      14
13  37/ 32/ 31                    T.N.T.    Maurizio Vittuari     142     528
14  43/ 44/ 14                      Test             J E Long     142       2
15  31/ 21/ 48            Impfinity v4g1               Planar     141    1002
16  36/ 32/ 32                 Torch t18              P.Kline     140      40
17  39/ 38/ 23                myConfuser             Paulsson     139      16
18  29/ 21/ 49                  Blizzard        Anton Marsden     137     522
19  29/ 22/ 49          Gem of the Ocean              P.Kline     136       1
20  25/ 14/ 61              Evol Cap 6.6       John Wilkinson     135     817
21  41/ 47/ 12                 Wild Card           M R Bremer     135     356
22  34/ 33/ 34           Jack in the box          Beppe Bezzi     134    1569
23  40/ 45/ 16                Mirage 1.5        Anton Marsden     134     716
24  22/ 11/ 67                    Q.S.P.             John K W     132     117
25   4/  0/  0         Lithium And Water     John K Wilkinson      12      12

Weekly age: 114 
New warriors 8  Turnover/age rate 7%
Average age: 431 ( 414 last week, 333 the week before )
Average score: 142 ( 135 last week, 139 the week before )
The top 25 warriors are represented by 15 authors.

These rankings are more current than the What's New/What's No More listings.
Sorry for the confusion but I had to kill my 200+ pizza messages rather than
sift through them.

Paul Kline shattered the monotony when he _reset_ Torch t18!  Jack in the
Box now is the all time age leader at 1569.  Impfinity and Frontwards both
have cleared the 1000 mark.  Now FOUR programs are over 1K and two more are
alrady over 800.

Boeren has refused to relinquish his strangle hold on the top spot.  Once 
Grilled Octopus started dropping, he patched some new code together and 
voila:  Grilled Octopus v0.5.  Stepping Stone has been as low as 10th place
but usually resides in the top 5.  His secret handshake used in this warrior
is revealed in the issue's hint section.  Age leader Jack in the box has been
residing in the bottom of the pack all week and may soon fall to p-warriors
and brainwashing programs.  
______________________________________________________________________________
94 - What's New

 #  %W/ %L/ %T                      Name               Author   Score     Age
 5  42/ 40/ 18                     C I A         Anders Ivner     143       1
25   6/ 51/ 43               Happy Paper   Christopher Gorski      61       1
20  30/ 33/ 37                 Torch t18              P.Kline     126       1
 1  42/ 35/ 23      Grilled Octopus v0.5         David Boeren     149       1
25  16/ 16/ 68             Obvious Thief        John K. Lewis     115       1
 9  38/ 40/ 22                myConfuser             Paulsson     137       1
14  40/ 44/ 16                Hipshot V2             J E Long     135       1
19  29/ 22/ 49          Gem of the Ocean              P.Kline     136       1
______________________________________________________________________________
94 - What's No More.

 #  %W/ %L/ %T                      Name               Author   Score     Age
26   1/  3/  0                  test cia         Anders Ivner       2       3
26   1/  2/  0                   Clisson              P.Kline       4      18
26   2/  1/  1                     C I A         Anders Ivner       7      47
26  29/ 36/ 35              Breeder V3.1             J E Long     123      60
26   3/  0/  0                   Hipshot             J E Long      10      94
26  30/ 39/ 31                 Torch t18              P.Kline     121    1539
26  35/ 47/ 17               S.E.T.I. II             John K W     124     163
26   2/  2/  0      Grilled Octopus v0.3         David Boeren       6     130
______________________________________________________________________________
94 - What's Old

 #  %W/ %L/ %T                      Name               Author   Score     Age
22  34/ 33/ 34           Jack in the box          Beppe Bezzi     134    1569
 4  43/ 40/ 16                      quiz              Schitzo     146    1202
 8  42/ 41/ 17             Frontwards v2       Steven Morrell     143    1055
15  31/ 21/ 48            Impfinity v4g1               Planar     141    1002
20  25/ 14/ 61              Evol Cap 6.6       John Wilkinson     135     817
 6  40/ 34/ 26               Thermite II        Robert Macrae     145     803
23  40/ 45/ 16                Mirage 1.5        Anton Marsden     134     716
 3  39/ 31/ 30               Tornado 3.0                Beppe     148     604
13  37/ 32/ 31                    T.N.T.    Maurizio Vittuari     142     528
18  29/ 21/ 49                  Blizzard        Anton Marsden     137     522
11  29/ 16/ 55      Hazy Shade Of Winter             John K W     142     431
21  41/ 47/ 12                 Wild Card           M R Bremer     135     356
 7  36/ 28/ 36                   Barrage        Anton Marsden     144     276
 5  40/ 34/ 26                 Chameleon           M R Bremer     146     274

Ten of these 14 warriors are already in the Hall!
______________________________________________________________________________
HALL OF FAME
* means the warrior is still running.

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

Marsden gets yet another active warrior on the Hall of Fame listings.
Blizzard replaces B-Panama X--a stone/replicator--by Steven Morrell.
______________________________________________________________________________
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  49/ 31/ 20                      Test          Ian Oversby     168      29
 2  48/ 31/ 21               Auntie v1.0          Ian Oversby     165      60
 3  40/ 16/ 44                Breeder V3             J E Long     164      75
 4  45/ 27/ 28              Evil Elf V.8       Andy Nevermind     163      64
 5  40/ 18/ 42                      NNAA        John K. Lewis     162      25
 6  39/ 19/ 42          Pretentious v0.2          Ian Oversby     160      30
 7  30/ 11/ 59             silkworm v3.0         Brian Haskin     148      76
 8  41/ 34/ 25              Judge Nutmeg         Scott Manley     148      79
 9  39/ 35/ 27             Paralyze v0.1          Ian Oversby     142      59
10  29/ 16/ 55          AB Scanner 2.9.4         Chris Hodson     142      90
11  40/ 40/ 19               Maniac v0.3          Ian Oversby     141      53
12  30/ 24/ 47     Hyakutake C/1996 B2 +         Scott Manley     136      36
13  22/ 11/ 67          Well Dressed Imp     Robert J. Street     134       5
14  33/ 37/ 30    Forked Lite Ning 4.074 Ansel Greenwood Serm     130      83
15  31/ 34/ 35              Pensive v0.3          Ian Oversby     128       2
16  22/ 18/ 59             RingWorm_v2.7           Calvin Loh     126      66
17  23/ 22/ 55               XXXOOO v2.0          Joshua Houk     125      41
18  29/ 33/ 37          Hyakutake Rising         Scott Manley     125      78
19  30/ 39/ 31           Alien Kiss V1.0       bjoern guenzel     121      27
20  22/ 25/ 53  Stephanie's Pajamas v1.2     Robert J. Street     120      14
21  31/ 47/ 22          Optma Dwarf v4.0              Phoenix     114      24
22  22/ 30/ 48  Stephanie's Pajamas v1.3     Robert J. Street     114       1
23  29/ 51/ 20                   GPT 09d        David van Dam     108      13
24  10/ 12/ 79                 ShadowImp     Robert J. Street     107      15
25  23/ 42/ 36      Pommes-Ketchup V1.33         S. Schroeder     103      23

Ian Oversby has staked out quite a claim on the beginners' hill with six
warriors including the top two rankings.  Ian has decided to share one of
his warriors with us.

;redcode-b
;name Auntie v1.0
;author Ian Oversby
;strategy v0.1  Searching for a good scanner.
;strategy v1.0  Shorter.
;assert 1
 
< boot deleted >
 
loop    ADD.F   cons,   scan
scan    CMP.I   -1,     11
        SLT.A   #30,    scan
fin     DJN.B   loop,   <-100
        MOV.I   b1,     }scan
count   DJN.B   -1,     #13
        SUB.A   #13,    scan
        MOV.AB  #13,    count
        JMZ.F   loop,   loop-5
cptr    SPL.B   #b1,    #b2+1
b1      SPL.B   #4,     #b2+2
        MOV.I   *cptr,  >cptr
        JMP.B   -1,     <-10
b2      DAT.F   #4,     #5
cons    DAT.F   #3359,  #3359

A quick look indicates a carpet bombing scanner strategy followed by a multi-
pass coreclear.  While this strategy is successful on the b-hill, it will not
even come close to making the '94 draft hill.  Timescape style replicators
used by most authors leave lots of decoys in core.  A carpet bomber spends
too much time attacking them.  A better strategy would be to attack with 
spl/spl/jmp bombs like Memories.  Also consider using a .8c scan engine 
instead of the standard .66c engine.

top	add.f step, comp
comp	sne.i X, X+SPREAD
	add.f step, comp
	seq.i @comp, *comp
	slt
	djn.f top, <STREAM
  
A spiral clear may be needed to kill DieHard style imp/papers.  Check out
Memories, Harmony, and SETI for examples.  Then agressively pspace the 
scanner with a decent bomber (or replicator) and you should gain a foothold
on the '94 hill.  Good luck.
______________________________________________________________________________
The Hint by KURT FRANKE

How to Handshake

  Whether or not it is right, when you challenge the hill, part of your
score comes from how well your warrior does against itself.  If we are
paper and tie every time, that is about 4 points.  If we are something
very aggressive and (nearly) split wins, that is about 6 points.  And if
we use a handshake (or we are very, very lucky) we get this: 

	Program "Stepping Stone" (length 95) by "Kurt Franke"
	(contact address "kurt@protector.lovett.rice.edu"):
	has challenged the ICWS '94 Draft hill.
 
	...

	Program "Stepping Stone" (length 95) by "Kurt Franke"
	(contact address "kurt@protector.lovett.rice.edu"):
	;strategy Vampire
	Stepping Stone wins: 200
	Ties: 0

  That is 12 points, 6 more than if I had let Stepping Stone split 
wins.  Sound good?  Want to know how?  Read on.

  When challenging the hill, we fight the other programs two hundred times
each.  Someone makes the first move in each round.  The way this works is
the challenger -- that is us -- goes first on the first round, and then it
alternates (the defending warrior goes first on the second round, etc). 

  When we fight ourself, the version that goes first on the first round is
the version we get points for.  So we want our warrior to realize when it
is fighting itself and have the right version win every time. 

  To recognize when we are fighting ourself, the obvious thing to do is
give our warrior a PIN and use pspace.  For an introduction to pspace, see
Core Warrior #5.  PIN's were not covered in that issue, but they are
simple.  The acronym stands for P-space Identification Number.  If we put
this line in our warrior,

	PIN	123

  Then we will share the same pspace as any other warrior that also has a
PIN of 123.  Note that this is just a pseudo-opcode; it doesn't count as
one of our 100 lines and you cannot find it in core.  It is just a message
to the simulator. 

  Now here is the handshake.  place1 and place2 are just numbers. One
version of our code needs to execute: 

	stp	#0, #place2	;; clear the expected flag
	stp	#1, #place1	;; set the flag for the other version
	ldp	#place2, #0	;; check if the other version set our flag

  While the other version simultaneously executes this:

	stp	#0, #place1	;; (notice place1 and place2 are exchanged)
	stp	#1, #place2
	ldp	#place1, #0

  If the load operations retrieve a 1, we know we are fighting ourself. 
The only trick is that, when fighting ourself, the two versions are
(almost) identical so how can they be executing different code?  Well,
there are two things different between the two versions.  The first thing
is pspace location 0.  p[0] is different from the other pspace locations. 
It returns the result of the last round, and it is *not* shared when you
use a PIN.  The second difference is that one version is one half-step
ahead of the other version. 

  It isn't obvious what can be done with the second difference, but using
the first difference,

last	ldp	#0, #0		;; fetch the result of the last round
	jmz	lost, $last

	stp	#0, #place1
	stp	#1, #place2
	ldp	#place1, #0

	...

lost	stp	#0, #place2
	stp	#1, #place1
	ldp	#palce2, #0

	...	

  Now if we lost the last round, we execute the second part, and if we won
or tied the last round, we execute the first part.  That is the basics of
a handshake.  The rest is just code to figure out who should win and who
should lose the next round once we know we are fighting ourself. 

  Robert Macrae, who first explained the concept of a handshake to me,
solved the problem in a very complicated (but interesting!) way.  Look at
his warrior Mason for details.  Mason keeps track of how many rounds have
passed.  If it is the first round or the last round was a tie, then there
is no difference in p[0] between the two versions and he just runs his
normal warrior.  Once he gets a win or loss, he tries the handshake and
flags whether it worked or not.  If the handshake fails (the ldp
instruction fetches 0), then Mason flags that he is fighting an enemy.
If it worked, then both versions commit suicide. 

  Commit suicide?  Yes.  He does that to find out which one moved first 
on that round.  (The one that moved first on that round will die first.)  
Knowing the result of the suicide round and the round number that the 
suicide occurred on, the warrior can calculate which version should win 
the rest of the rounds.

  Mason's handshake is lengthy (44 lines).  It also has a nasty bug, which
was Mason's downfall.  The bug is that it only does the handshake once and
then relies on values set in pspace after that.  So, by brainwash or by
some paper making him execute the wrong lines in his code, he can be
fooled into thinking he is fighting himself and lose all the rounds: 

	Program "Hector 2" (length 96) by "Kurt Franke"
	(contact address "kfranke@rice.edu"):
	;strategy qscan -> replicator
	Mason 2.0 wins: 0
	Hector 2 wins: 187
	Ties: 13

	(Hector enjoyed that score immensely.)

  Now let me describe my current handshake (the one in Stepping Stone).  
My goals were to make sure I can't lose every time, and to reduce the 
size.

  The first goal is easily accomplished.  Stepping Stone will run the
handshake code (that communicates through shared pspace) every round
unless he knows he's fighting an enemy. There is no way the handshake can
be fooled, unless my enemy has my PIN and the numbers place1 and place2
used for the handshake.  The second goal is accomplished through giving up
the first round against everyone but myself.  Let me explain;
automatically losing the first round is not as crazy as it sounds.
(You hear maniacal laughter in the distance.)

  Suppose that on the very first round we have the challenger version (the
one we get points for) win.  Then on subsequent rounds, all that must be
done is this:  Run the handshake; if it works, then we are fighting
ourself and should have the same version win as won the last round.  The
trick is to have the right version win on the first round.  And my
solution is to use the second difference that exists between versions. 
The version we want to lose is a step behind the one we want to win.  Here
is the special code for the first round, which should be at the end of the
warrior: 

search  jmz.f   search, {count          ;; find the other copy

count   sne.i   #-100, {count           ;; skip the next line if we are #2
        jmp     $0, {count
	dat	0, 0			;; just empty core after the warrior

  All this is is a backwards scan for the other copy.  On every cycle,
count is decremented.  When we find the other copy, we compare the two
counts.  If they are different, then that version must be one step behind
the other version, and so it kills itself.  If the two counts are the
same, then we win by waiting for the other version to find us and kill
itself.  And if we are fighting some other warrior, we surely die. 

  And that's all there is to it.  Here is my handshake code (21 lines)

;redcode-94
;assert 1

;author Kurt Franke
;name Socrates

;strategy Know Thyself
;strategy  Handshake -> wait

wait	jmp	wait			;; real tough guy :-)

;; - - - - - - - - - handshake constants - - - - - - - - - - - - - - -

        PIN     1

ENEMYP          equ     1		;; flag for enemy warrior
WINP            equ     2
LOSEP           equ     3
HWARRIOR        equ     wait		;; our regular warrior

;; - - - - - - - - - handshake initialize - - - - - - - - - - - - - -

enemy   ldp	#ENEMYP, #0
        jmn     HWARRIOR, $enemy        ;; if flag is set, fight

last    ldp     #0, #0
        sne     #-1, $last              ;; check for first round
        jmp	search			;; special routine for first round

;; - - - - - - - - - - - - try handshake - - - - - - - - - - - - - -

shake   jmz     lost, $last             ;; the actual handshake
won     stp     #0, #LOSEP              ;; reset the expected flag
        stp     #1, #WINP
loser   ldp     #LOSEP, #0              ;; and then check it
        jmz     foe, $loser
        jmp     0                       ;; wait


lost    stp     #0, #WINP               ;; reset the expected flag
        stp     #1, #LOSEP
winner  ldp     #WINP, #0               ;; and then check it
        jmz     foe, $winner
	dat     $0, $0			;; lose again

;; - - - - - - - - - - - flag enemy warrior - - - - - - - - - - - - - - -

foe     stp	#1, #ENEMYP
	jmp     HWARRIOR

;; - - - - - - - - - special first round routine - - - - - - - - - - - - -

;; Determine who moved first without pspace
;;  1st version waits till timeout and second kills itself

search  jmz.f   search, {count          ;; find the other copy

count   sne.i   #-100, {count           ;; skip the next line if we are #2
        jmp     $0, {count

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

        end     enemy

Try running it:

	protector:~/redcode$ pmars -r 100 socrates.red socrates.red -b
	Socrates by Kurt Franke scores 300
	Socrates by Kurt Franke scores 0
	Results: 100 0 0

  Pretty nifty, eh?  I'll conclude with two remarks: 

  First, it is pretty easy to make all of your warriors handshake with
each other to split wins and get more points.  However I think only a real
weasel would do this.  You are on your honor. ;-)

  Second, I can't see any reason (except lack of space) why most of the
warriors on the hill wouldn't add a handshake.  It adds at least 5 points
to the score and only costs two cycles once the enemy flag is set.  But I
think it would be very boring if everyone started using handshakes.  I
like variety.  So perhaps we should just legislate against PIN numbers on
the koth servers.  (?)

  I hope you found all of this interesting,

- Kurt Franke
  kurt@protector.lovett.rice.edu
______________________________________________________________________________
Questions?  Concerns?  Comments?  Complaints?  Mail them to people who care:
authors: Beppe Bezzi <bezzi@iol.it> or Myer R Bremer <bremermr@ecn.purdue.edu>
contributors this issue:  Kurt Franke <kurt@protector.lovett.rice.edu>
© 2002-2005 corewar.info. Logo © C. Schmidt