Core War: Two Programs Enter, One Program Leaves

Actually, I’m taking part in organizing a contest that is very similar to Core War.
As part of the Israeli CodeGuru contests (www.codeguru.co.il) for teenagers there’s a competition called CodeGuru Extereme, where participants write assembly code that is then ran in the competition in an arena, with all kinds of interesting twists. =)

“I like the green on black text, I read some stuff that said it is supposed to be easier on the eyes.”

I find that it strongly depends on the environment.

While sitting in a bright/well-lit room, black text on white background really is easiest for me to read. But, if the monitor’s brightness is significantly higher than ambient lighitng, then trying to read dark text on a light background gives me a headache - like trying to read the fine print on a lightbulb while its on.

“…To all who oooh-and-aaah about real world uses of CoreWar, just a quick reminder: viruses, worms and trojans are a “social” form of corewar programs…” So sayeth Sam on April 2, 2008 10:01 AM.

Yes, Sam (oh, mighty disparager of VB), we know about viruses, etc. Nonetheless, a big thank you for pointing out the obvious. Perhaps in the real world, anti-virus apps could employ some ideas from core war champs…

@Matt:

“MOV current current+1” copies the currently running instruction into the next memory location. When the instruction is not JMP, the next command in memory is then run. Thus, it is a one-line program that copies itself into the entire memory space. (Redcode uses a circular memory space, so it loops around at the end.)

It’s hard for a bomber to defeat that program, since it replicates on every single instruction. The only way to defeat it is for the opponent to overwrite the just-written instruction right before it is run.

Since the programs take turns on every instruction, a sophisticated program typically doesn’t have time to do anything before being overwritten by a simple one.

This is all very well and good, until someone hooks this thing up to NORAD’s missiles and bombers. I bet it’ll decide our fate in a nanosecond.

@Matt:

You are correct. That program is the Imp and it never wins it only leads to stalemates. It just writes the whole core to move instructions and so it becomes nearly impossible to kill, but yet it can’t win either.

Core Wars and the derivatives some people mentioned got me thinking of a neat little project… maybe genetic programming can be used to create a better competitor.

This is really nice, RoboCode is even better :D.

Thanks alot for bringing that up

how come we dont hear about such things these days? i think this one for me was a coincidence!

wow, I’m going to show this site a friend!

I’m dissappointed I couldn’t be the fist one to plug the avida project (devo lab). The moment I saw an article on code wars I got so excited that it might be on avida.

I’ll never forget the the final lecture in my compilers class when I first saw Prof. Ofria’s presentation on Avida. It is still by far the most incredible thing I’ve ever seen in computing. Programs that can reproduce and evolve just like biological organisms? Wow and that’s just the beginning of the complex phenomonon studied by this project!

Then, years later, I even got a double dose when Dr Pennock talked about Avida in his presentation on the Kitzmiller v. Dover Area School District case in which he testified.

Oddly enough, I was just thinking about those old Scientific American articles. I started reading some of them in 1987 to 1988 time-frame. At that time I had a Commodore C128 and it really was fun to read the articles. Oh the memories!!

I wonder how many virus/worm/trojan programmers cut their teeth reading these articles.

*Snathi, Windows didn’t exist when this codewar was written about. So this is not the codewar you’re thinking of…and these are not the driods you are looking for.

Some comments from a reddit post that I thought deserved to be echoed here:

http://reddit.com/r/programming/info/6eb2g/comments/

  • there’s no mention of redcode’s rich addressing modes (8 in the last revision)
  • there are two variants with different opcode sets, redcode’88 (ICWS-88) and ICWS-94; the latter adds multi-processing and state saved across runs (so the warrior can choose the best strategy based on previous outcomes)
  • there are several hills with different opcode sets and core sizes. AFAIK the most popular ones are hosted at koth.org.
  • the three basic strategies he lists (paper, stone, scissors) are not the only fundamental ones; you could add at least imp(-spiral)s, and vampires which trick the opponent’s process(es) into executing your code
  • you can see the evolution of the state of the art in the Core Warrior newsletter (http://corewar.co.uk/cw/)

This is incredible. Thanks for exposing me to it.

Whats with the green and black layout. I thought that was an April’s Fools joke but it is still there. It is so hard to read, not to mention that it is annoying. You more than others should understand human factor and UI conventions. And the convention is that people are used to read black on white. Could you please provide an alternative style at least.

My bad. It was simply cached in the browser.

Hey, I sent your article to my Digital Logic teacher, it seems he will a CoreWar with FPGA, we will build a processor implement it in a FPGA and then play CoreWar in it. Very cool, thanks Jeff.

I’m loving this idea - I haven’t tried it out yet but I’ve downloaded it for when I have a spare hour or so… I’ve tried many “bot battle” things in the past seeking programming “victory”, but they’ve never been that satisfying. I get the feeling this will be a little different!

Thanks for the suggestion Jeff!

I remember I read a book a long time ago. The author (I don’t remember his name) gave Dewdney the “honour” of invent the computer viruses. He said that some time after the Core War game was introduced, the first actual viruses came out. I don’t know if it’s historically exact.

Rich Skrenta may have invented the computer virus with “Elk Cloner” in 1982; that predates Core War

http://en.wikipedia.org/wiki/Elk_Cloner

Hehe, remembers me the time back 1993 when I wrote a core war simulator with my cousin in Turbo Pascal. But writing the simulator was much more exciting than writing red code programs.