Solving a 18-year-old Core War mystery

Solving a 18-year-old Core War mystery

As some readers might know, I sometimes play a programming game called Core War. This afternoon I was browsing through some old ‘Core Warrior’ newsletters which John Metcalf has collected here. When reading an article about an old successful warrior called ‘Thermite II’ I came across this tiny unsolved mystery:

-- Bug?

John K.W. mailed me with a tiny, suicidal warrior which managed to beat
Thermite once in two hundred times. All I can imagine is that, that one
time, I somehow scanned his code within its few cycles of life, and that
then I crashed as a result. But how?

Program "Thermite II" (length 100) by "Robert Macrae"
;strategy Same old strategy, but nastier...
Killing Hazy Shade Of Winter III wins: 1
Thermite II wins: 199
Ties: 0

How did I get a win against Thermite?!?!
Here is an EXACT copy of what I sent to Pizza...
Thermite would've had to die within 3 cycles! ... :/

;name Killing Hazy Shade Of Winter III
;kill Hazy Shade Of Winter III
;author John K W

p: ldp.b #0, #0
jmp <-1

Any ideas, anyone :-?


When executing the code of the second warrior “Killing Hazy Shade Of Winter III” I noticed there is a false assumption in the email. The warrior doesn’t need to die in three cycles!

The first round it’ll execute:

LDP.B #0,#0 (and become LDP.B #0,#-1)

Then it executes:

JMP <-1 (to a location two higher than the warrior, which is usually empty code… but not always!)

The final line in Thermite’s code is a JMP instruction to the launch-instruction which loads Thermite’s bomber ‘Brand’. If John K W’s warrior was loaded at a position 100 or 101 from Thermite it would parasite into the bomber and become Brand before Thermite itself does. This is how the small seemingly suicidal warrior can kill Thermite.

After 18 years, Q.E.D. :-)