Core War: Two Programs Enter, One Program Leaves

Our old pal A. K. Dewdney first introduced the world to Core War in a series of Scientific American articles starting in 1984. (Full page scans of the articles, including the illustrations, are also available.)

This is a companion discussion topic for the original blog entry at:

Another great post.

I was never to impressed by this kind of programing, but now I will give it a try.

Code wars here I come!

I usually lurk through, don’t comment, but thanks for reverting back to the old theme.

The ‘Matrix’ theme was not very professional, though it showed that this is a geek’s blog. Hard on the eyes.

Thanks for the responses, I do not think that the mov current current+1 would work to end in anything but stalemate.

However, depending on the instruction set a variant would work if it was:
movdoubleword current current+1
illegal opcode

I find this interesting because:
I once tried to write a program like mov current current+1 on a motorola processor, but it was not possible because the move double word instruction was a double word itself and the operand was a word. So, I would have needed a move triple word, which did not exist:) And of course the move word instruction was 1 word + a 1 word operand.

For a more modern programming game, check out BitBath (

Armies of bots fight in a virtual battlefield, capturing cities, navigating terrain, and communicating over radio.

This game uses a custom JVM, which means it’s the only programming game in existence that both uses a modern programming language (Java) and has precise instruction counting (crucial for ensuring fairness and reproducability.) It’s also a lot of fun!

Thanks Jeff for another thing I learnt from your blog. I will try core wars.

I was fiddling with this just the other day. It certainly teaches you how to write fault-proof code :wink:

Cool to see an easy implementation of Assembly, “deliberately simple”, and quite intuitive… the way it should’ve been, regarding the naming convention.

Someone now needs to make a CoreWar facebook app.

Commercial success guaranteed.

Corewar facebook app! Finally a good facebook idea…

Reminds me of Terrarium: showcase .NET application. It was higher level then core wars, creatures were graphical and underlying code had functions like bite(), eat() and look(). You upload your dll to server and watch your creature perform.

It can still be found at

Ever heard of IBM’s Robocode?

Wow. I played Core Wars for a while about five years ago, but never was very good at it. Even my best warrior couldn’t get past 5th on the beginner hill. But it was a lot of fun, and I learned a lot about assembler (even though redcode is a toy language).

Please please change your color scheme back to the old one :slight_smile:

I thought it was just an April 1st Joke but you seem to be serious. This is hardly readable :frowning:


I was just about to post the same thing. Try a CTRL-F5 to refresh the CSS and it should be back to normal.

Ahh, I’ve been looking for something useful to put my assembly skills to use on (and by ‘skills’ I mean ‘small amount of experience’).

Perfect. Thanks, Jeff.

Robocode is the way to go. Its like Battlebots on the computer.

That is a fascinating field.
The best corewar program I have ever seen is Firefox2.
If it is running, you cannot run anything else.

Brings back memories. Trying to write original material for CoreWars that actually worked mainly just made me feel stupid. Still, it’s fun to watch.


It is in Java.
You have tanks/robots driven by your own algorithms to fight other robots on the battlefield.

You can have team battles, where a number of your robots work as a team to beat the other team.

That is a lot of fun, and good starting place for those who want to learn Java. Bare minimum java/programming experience needed to start building your own robots.

Have fun.