From: pk6811s@acad.drake.edu
Newsgroups: rec.games.corewar
Subject: Re: Types of bombs
Date: 9 Oct 92 19:24:26 GMT
Article-I.D.: acad.1992Oct9.132426.1
Organization: Drake University, Des Moines, Iowa, USA

In article <70624@hydra.gatech.EDU>, gt6525c@prism.gatech.EDU (Damon Gallaty) writes:
(Parts of this note are taken from my article "stone.better.txt" on
soda.berkely.)

> I was just curious about people's ideas on bombing. If you're going to
> bomb someone, why use decrementing, jmp's to slave pits, and such? WHy
> not just bomb a typical DAT and destroy them right there? It seems
> . . .
> 
> - Damon Gallaty
> 

Ok Damon, good question that many new players ask.  First, jmps to slave
pits or stun-bombs are needed to overcome replicating opponents, like
mice or 'paper'.  If you only bomb with dat-zero, you'll lose 80 or 90%
of your battles against replicators, you just can't catch them all (at
the same time).

Example stun bombs:
        -------
         spl 0
        -------
         spl -1
        -------
         spl 0      <- recommend this one
         jmp -1
        -------
         spl 0,8    <- sometimes fought off by paper
         mov -1,<-1
        -------
         spl -1,0   <- sometimes reaches out and grabs you
         mov -1,<-1 <- but good against paper-colonies
        -------

(Another term is 'carpet bombing' where you lay down a series of spl 0's)

Second, decrements are a free extension of the bombing process, they
cost you nothing and hopefully give your opponent fits.  Here's an example
of an old 'stone' type bomber:

	;name Twill
	;author Andy Pierce
	offset	dat #-5138,#5138
	start	spl 0,0
		add offset,1
		mov <0,0
		jmp -2,0
		end start

Now, just because it's old-fashioned, doesn't mean it's not effective.  Twill
used to hang around the top of the hill most of the time, because it beat
up on all the scanners out there.  Anyway, you'll note that Twill bombs
one location with a three-instruction loop - a real honest bomb that will
probably kill whatever is there.  Also, by using the predecrement form
on the a-operand, Twill decrements another location.  Thus Twill 'trashes'
two locations with three instructions.  (If you didn't know before, the
add instruction adds both the a- and b-operands.)

The two important considerations for bombers are pattern and throw-weight.
Twill has a excellent pattern, checkering core rapidly then filling in 
the blanks.  Twill also has good throw weight, bombing one location
and decrementing one every three instructions, or 66% of c.

Now consider this fighter:

	;redcode
	;name Emerald
	;author P.Kline
	inc      dat #-2045,#2045
	emerald  spl 0,100
	stone    mov <cnt+102-300,<cnt+100
	         add inc,stone
	cnt      djn stone,<-3799
	         end emerald

Emerald exhibits two improvements that give it greater throw-weight, 
bombing one location and decrementing three every three instructions.
First, on the 'cnt' line, note the use of djn.  Every time 'cnt' executes,
it decrements a new location, working backward from -3799.  Charon v 7.0
and Flash Paper do the same thing.

Second, note the b-operand on the 'stone' line.  It is predecremented
just like the a-operand.  This gives the effect of decrementing a location,
then bombing wherever it then points.  Line 'stone' decrements two locations
and bombs a third.

Emerald is the same size as Twill, but trashes four locations in 3 instructions.
Emerald trashes core at 133% of c, previously thought to be impossible.
But 133% is not the limit.  If we expand Emerald like this:

	;redcode
	;name Emerald
	;author P.Kline
	inc      dat #-2045,#2045
	emerald  spl 0,100
	stone1   mov <a,<c
	         add inc,stone1
	stone2   mov <c,<d
	         add inc,stone2
	cnt      djn stone1,<-3799
                 end emerald

we now have two mov instructions, each trashing three locations every time
through the loop - seven locations trashed with five instructions - for
a rate of 140% of c.  In fact if we had an endless stream of mov/add 
lines, the rate would be 150%, which is the limit using this technique.
Of course as Emerald gets larger it becomes much harder to protect it
from itself, and also makes it a bigger target for scanners.

Now consider another fighter:

	;redcode
	;name ExtraExtra
	;author P.Kline
 inc      dat #0-4023,#4023
 stone    mov <1,<1+24
          spl -1,<cnt-796
 next     add inc,stone
 cnt      djn stone,<-797
          dat #100
          dat #100
          dat #100

ExtraExtra decrements both the a- and b-operands, and uses the djn instruction
just like Emerald, yet is different.  The spl 0 instruction has been moved
below 'stone' and is changed to a spl -1.  You have to observe this to see
the effect in action.  There are growing bursts of mov/add instructions
alternating with bursts of spl/djn instructions.  The result is longer and
longer bursts of mov/add instructions, trashing core at 150% of c.  Eventually
the bursts become long enough that the entire core is checkered at 150% of c.
I also modified the spl to predecrement the same location as the djn, so
that it trashes every other location.

Another idea I have experimented with is using the djn stream to detect 
a replicating opponent.  The djn falls through when the location that's 
decremented contains a "1" in the b-field.  If you are a bomber, you are
going to lose against paper, no matter how fast you are, so give up
and do something different - like imping or mousing or anything!
As it turns out, most of the 'paper' style replicators have one instruction
with a "1" in the b-field.  When the djn stream rides over this it falls
through to the next instruction, which is your plan-b.  My program Encore
was able to change 85% losses against Note Paper to 50% ties using this
technique.

By-the-way, here's the 'secret-code':

   stone       =  a bomber
   paper       =  a replicator
   scissors    =  a scanner, pit-trapper, or vampire

By experience we know that scissors beats paper beats stone beats scissors.
However, we are now seeing the emergence of successful dual-technique fighters.

Paul Kline
pk6811s@acad.drake.edu