Core War

From Knox Makers Wiki
Jump to navigation Jump to search

Intro

From the Core Wars FAQ:

"Core War is a game played by two or more programs (and vicariously by their authors) written in an assembly language called Redcode and run in a virtual computer called MARS (for Memory Array Redcode Simulator). The object of the game is to cause all processes of the opposing program to terminate, leaving your program in sole posession of the machine."

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

http://www.corewar.info/emulator.htm

Get Core War

pMars (use this)

http://www.koth.org/pmars/

wget ftp://ftp.univie.ac.at/systems/linux/fedora/updates/13/i386/pmars-0.9.2-4.fc13.i686.rpm
wget ftp://ftp.univie.ac.at/systems/linux/fedora/updates/13/x86_64/pmars-0.9.2-4.fc13.x86_64.rpm

Or . . . http://sourceforge.net/projects/corewar/files/ (Source and some binary packages here, but are pretty old and 32 bit only)

Running 64 bit?

If you try to compile the source and get the message "GLIB >= 1.2.0 not installed - cannot build GUI client without it", despite having glib2-devel installed, it seems to be looking for the glib-config script, which was replaced in later glib versions with pkg-config as described here You might be able to use the 32 bit dev package as described here, though I've not tried it.

Using Debian / Ubuntu?

You can download the source and build it. On 32 bit Ubuntu 10.04 I had no trouble with 'cd src' and then just 'make' which resulted in the pmars binary being correctly built. It may fail on 64 bit as described above. You can then do a sample run with two warriors like:

user@host:~/pmars-0.9.2$ src/pmars warriors/aeka.red warriors/rave.red 

The default option in the makefile built in X11 support automatically. I believe there is an ncurses option too.

(You can also use alien to make a .deb from the .rpm and just install that.)

Running Windows?

Really? Windows? Well - okay. (Let's talk at the next meeting okay?) But if you must, you can likely find some Windows binaries here

Sample Run

Sample run using two provided warriors:

user@host:~> pmars -r 3 /usr/share/doc/pmars-0.9.2/warriors/aeka.red /usr/share/doc/pmars-0.9.2/warriors/rave.red

Documentation

Start with corewar-faq.html (in the doc directory if installed from source, or usr/share/doc/pmars-0.9.2/doc/corewar-faq.html if from rpm)

Then move on to this beginners guide and other guides found here

Additional documentation can be found here

Competition

Various competitions can be held, such as this king of the hill one here

Other Simulators

nMars

Looks interesting, but needs .net / mono

http://nmars.sourceforge.net/screenshots.shtml