Mars (Memory Array Redcode Simulator) is an implementation of a famous programmer's game in which gladiators (in the form of programs written in the Redcode assembly language) are placed randomly into an arena (the simulated magnetic core memory array). They must then find and destroy their opponents before their opponents find and destroy them. Redcode programs are unique in my experience, as they are able to repair their own code when damaged. Mars includes an ADE for writing RedCode, a Redcode assembler, and an arena operations controller. Such a collection of tools is usually called a Core Wars hill.
You can download the student's manual here.
About CORE WARS
The idea of CORE WARS was invented in 1984 by DG Jones and AK Dewdney of University of Western Ontario. A 'core' was a circular magnetic ring through which two magnetizing wires were passed; the wires being able to change the magnetic state from 'up' to 'down' (0 to 1) or vice versa. A rectangular grid of such cores was called a random access memory array, or the core memory of a mainframe computer. When silicon-based transistorized memory was invented, such magnetic cores became obsolete, but we still often talk of RAM as core memory. In CORE WARS computer programs do battle in a simulated computer core. The arena in which they do battle, together with the associated logistics to stable the warriors and stage the battle, is called a 'Hill'. Throughout the 80s and 90s many hobby programmers wrote their own versions of a CORE WARS hill, me among them. My first hill was written in GW Basic. This one is in C++. I introduced my students to CORE WARS in the 2000s, and they enjoyed the challenge of writing code in the assembler language called RedCode.
To design this application, I did some research and found documentation as follows:
Original Specifications - As written by DG Jones and AK Dewdney in 1984. Download here.
Discussion of the RedCode language standards for 1986 and 1988. Download here.
Proposed RedCode language standards for 1994. Download here. I followed this standard.
An NTF (Note to file) about how I implemented directives in my RecCode. Download here.
Warrior techniques and ploys:
This is a fascinating game for what you can do, as well as what students learn about programming.
Famous warriors are: the imp, the hopper, the mouse, the fortress.
Interesting offensive and defensive techniques are: data bombs, imp bombs, imp stompers, self-repairing code, imp traps, hopping about, code theft, pointer enslavement, exponential reproduction.
The imp, for example, is a nasty little program consisting of a single instruction 'MOV 0 1'. This moves the contents of the byte found at relative address offset 0 to the byte found at relative address offset 1. The imp takes one step forward. As it moves forward it replaces all code in its path with a 'MOV 0 1' instruction. All more sophisticated warriors must be able to deal with this speedy and destructive little monster. Some stomp on them. Some throw them at enemies, or throw them randomly. Some search for its telltale trail of dead MOV instructions, find, capture and enslave the enemy imp. Once an imp is enslaved, a warrior can toss imp bombs using the enemy's own imps to work against him. Some warriors ignore the imps and just reproduce so quickly the imps cannot eat all copies.
When you first open the Mars application you will be greeted with a splash screen and a welcome screen.
MARS Splash Screen
MARS Welcome Screen
After you click through the welcome screen, you will be presented with the empty arena.
Note the following:
- A screen shot of the 'file' commands and the 'operations' commands are shown below. There is no user documentation, so you need to figure it out from the RedCode standards documents, and by intuition.
- I call the RedCode gladiators wryrs. The default 'wryr in focus' (WIF) is one called 'os-hopper'. You can edit the WIF as RedCode, assemble it, store it in a registry (library) or get it from the registry in text or assembled form, load and link it into the arena.
- There are many toolbar buttons to do registry operations, or to adjust statistical collections.
Last updated: September 2014