Core War

Core War
Core War
Core War screenshot
A game of Core War running under the pMARS simulator
Original author(s) D. G. Jones & A. K. Dewdney
Initial release 1984
Type Programming game

Core War (or Core Wars) is a programming game in which two or more battle programs (called "warriors") compete for the control of the "Memory Array Redcode Simulator" virtual computer ("MARS"). These battle programs are written in an abstract assembly language called Redcode. The object of the game is to cause all processes of the opposing program(s) to terminate, leaving the victorious program in sole possession of the machine.



Core War was inspired by a program called Creeper and a subsequent program called Reaper that destroyed copies of Creeper.[citation needed] Creeper was created by B. Thomas at BBN.[1] Dewdney was not aware of the origin of Creeper and Reaper and refers to them as a rumor originating from the Darwin game and the worm experiments of Shoch and Hupp.[clarification needed]

The 1984 Scientific American article on Core War[2] nonetheless cites the game Darwin, written by Victor A. Vyssotsky, Robert Morris Sr., and M. Douglas McIlroy at the Bell Labs in the 1960s. The word "Core" in the name comes from magnetic core memory, an obsolete random access memory technology. The same usage may be seen in other computer jargon terms such as "core dump".

The first description of the Redcode language was published in March 1984, in Core War Guidelines by D. G. Jones and A. K. Dewdney.[3] The game was introduced to the public in May 1984, in an article written by Dewdney in Scientific American. Dewdney revisited Core War in his "Computer Recreations" column in March 1985,[4] and again in January 1987.[5]

The International Core Wars Society (ICWS) was founded in 1985, one year after Dewdney's original article. The ICWS published new standards for the Redcode language in 1986 and 1988, and proposed an update in 1994 that was never formally set as the new standard.[6] Nonetheless, the 1994 draft was commonly adopted and extended, and forms the basis for the de facto standard for Redcode today. The ICWS was directed by Mark Clarkson (1985–1987), William R. Buckley (1987–1992), and Jon Newman (1992–); currently the ICWS is defunct.[7]


Redcode is the programming language used in Core War. It is executed by a virtual machine known as a Memory Array Redcode Simulator, or MARS. The design of Redcode is loosely based on actual CISC assembly languages of the early 1980s era, but contains several features not usually found in actual computer systems.

0000:  ADD.AB  #   4, $   3
0001:  MOV.F   $   2, @   2
0002:  JMP.B   $  -2, $   0
0003:  DAT.F   #   0, #   0

Assembled ICWS-94 style Redcode

Both Redcode and the MARS environment are designed to provide a simple and abstract platform without the complexity of actual computers and processors. Although Redcode is meant to resemble an ordinary CISC assembly language, it differs in many ways from "real" assembly:

  • Redcode has very few operations — 10 in ICWS-88 and 18 in ICWS-94.
  • Each assembled instruction is divided into an instruction code and two numeric fields. No numeric value is defined for the instruction code. The code may only be copied as part of an entire instruction, and may only be compared for equality.
  • Besides the opcode and two numeric operands, ICWS-94 allows each Redcode instruction to have a modifier that defines the size (one field, both fields, or entire instruction) of the data that the instruction operates on. Additionally, each of the numeric fields has associated addressing mode. ICWS-88 defines 4 addressing modes, and ICWS-94 extends this number to 8.
  • Each Redcode instruction has the same length and takes the same time to execute. The memory is addressed in units of one instruction.
  • All numbers are unsigned (i.e. non-negative) integers less than the size of the memory. Therefore there is a one-to-one correspondence between numbers and memory locations. All arithmetic is done modulo the size of the memory.
  • Only relative addressing is used. That is, address 0 always refers to the currently executing instruction, address 1 to the instruction after it, and so on. Addresses past the end of the memory wrap around to the beginning. This way, a program cannot (and need not) know its absolute location in the memory.

Each program can also have several active processes, each having its own instruction pointer. Each program starts with only one process, but others can be created with the SPL instruction. The processes for each program execute alternately, so that the execution speed of each process is inversely proportional to the number of active processes the program has. A process dies when it executes a DAT instruction or performs a division by zero. A program is considered dead when it has no more processes left.

Key features

No numeric instruction values
The Redcode standard leaves the underlying representation of instruction codes undefined, and provides no means for programs to directly access it. Arithmetic operations may only be done on the two address fields contained in each instruction. The only operations supported on the instruction codes themselves are copying and comparison for equality.
No absolute addressing
All addresses are interpreted as offsets relative to the instruction containing them. Since the address space wraps around, it is in fact impossible for a Redcode program to determine its absolute address.
Low level multiprocessing
Instead of a single instruction pointer a Redcode simulator has a number of process queues, each containing a variable number of instruction pointers which the simulator cycles through. New processes may be added to the queue using the SPL instruction.

Other notable features of Redcode include:

No external access
Redcode and the MARS architecture provide no input or output functions. The simulator is a closed system, with the only input being the initial values of the memory and the process queues, and the only output being the outcome of the battle, i.e. which programs had surviving processes. Of course, the simulator may still allow external inspection and modification of the memory while the simulation is running.
Constant instruction length and time
Each Redcode instruction occupies exactly one memory slot and takes exactly one cycle to execute. The rate at which a process executes instructions, however, depends on the number of other processes in the queue, as processing time is shared equally.
Relatively few instructions
The earliest published version of Redcode had only eight instructions, while the currently used version has eighteen. However, Redcode supports a number of different addressing modes and (in later versions) instruction modifiers which increase the actual number of possible opcodes to several thousand.
All addresses are valid
All numbers in Redcode are treated as unsigned integers, and the maximum integer value is set to equal the number of memory locations minus one. Thus each integer is a valid address, and each memory location has exactly one valid address. Numbers that would fall outside the valid range are wrapped around according to the usual rules of modulo arithmetic.
Circular memory
As a consequence of the above and the lack of absolute addressing, the memory space (or core) appears to the programs in it as a circle with no definite start or end. A process that encounters no invalid or jump instructions can continue executing successive instructions endlessly, eventually returning to the instruction where it started.


A number of variants of Redcode exist. The earliest versions described by A. K. Dewdney differ in many respects from the later standards established by the International Core War Society, and could be considered a different, albeit related, language. The form of Redcode most commonly used today is based on a draft standard submitted to the ICWS in 1994 that was never formally accepted, as the ICWS had become effectively defunct around that time. Development of Redcode, however, has continued in an informal manner, chiefly via online forums such as the[8] newsgroup.

Non-game use

In principle, Redcode can be used for purposes other than Core War.[9][10]

Earliest versions

The earliest published description of Redcode is found in the Core War Guidelines[11] published in March 1984 by A. K. Dewdney and D. G. Jones. The language as described here differs significantly from the later variants, being in many ways closer to actual assembly languages of the era.

The Guidelines describe a set of only eight instructions, but it is stated that the earliest implementations of Redcode by Dewdney and Jones had a larger instruction set. Indeed, the language described in the Guidelines is best seen more as a basis for other developers to expand on than as an actual standard.


Warriors are commonly divided into a number of broad categories, although actual warriors may often combine the behavior of two or more of these. Three of the common strategies (replicator, scanner and bomber) are also known as paper, scissors and stone, since their performance against each other approximates that of their namesakes in the well known playground game.[12]

  • A bomber (or rock) blindly copies a "bomb" at regular intervals in the core, hoping to hit the enemy. The bomb is often a DAT instruction, although other instructions, or even multi-instruction bombs, may be used. A bomber can be small and fast, and they gain an extra edge over scanning opponents since the bombs also serve as convenient distractions. Bombers are often combined with imp spirals (see below) to gain extra resiliency against replicators. The second published warrior in Core War history, Dwarf[13] by A. K. Dewdney, was a bomber.
  • A replicator (or paper) makes repeated copies of itself and executes them in parallel, eventually filling the entire core with copies of its code. Replicators are hard to kill, but often have difficulty killing their opponents. Replicators therefore tend to score a lot of ties, particularly against other replicators. The earliest example of a replicator is Mice[14] by Chip Wendell.[15]
    • A silk is a special type of very rapid replicator, named after Silk Warrior[16] by Juha Pohjalainen. Most modern replicators are of this type. Silk replicators use parallel execution to copy their entire code with one instruction, and begin execution of the copy before it is finished.[17]
  • A scanner (or scissor) is designed to beat replicators, usually by bombing memory with SPL 0 instructions. This causes the enemy to create a huge number of processes which do nothing but create more processes. This slows down useful processes. When the enemy becomes so slow that it is unable to do anything useful, the memory is bombed with DAT instructions.
    • A scanner doesn't attack blindly, but tries to locate its enemy before launching a targeted attack. This makes it more effective against hard-to-kill opponents like replicators, but also leaves it vulnerable to decoys. Scanners are also generally more complex, and therefore larger and more fragile, than other types of warriors.[18] He Scans Alone by P. Kline is an example of a strong scanner.
    • A vampire or pit-trapper tries to make its opponent's processes jump into a piece of its own code called a "pit". Vampires can be based on either bombers or scanners. A major weakness of vampires is that they can be easily attacked indirectly, since they must by necessity scatter pointers to their code all over the core. Their attacks are also slow, as it takes an extra round for the processes to reach the pit. myVamp5.4[19] by Paulsson is a good example of a vampire.
    • A one-shot is a very simple scanner that only scans the core until it finds the first target, and then permanently switches to an attack strategy, usually a core clear. Myrmidon[20] by Roy van Rijn is a simple, yet effective oneshot.
  • An imp (named after the first ever published warrior, Imp[21] by A. K. Dewdney) is a trivial one-instruction mobile warrior that continually copies its sole instruction just ahead of its instruction pointer. Imps are hard to kill but next to useless for offense. Their use lies in the fact that they can easily be spawned in large numbers, and may survive even if the rest of the warrior is killed.
    • An imp ring or imp spiral consists of imps spaced at equal intervals around the core and executing alternately. The imps at each arm of the ring/spiral copy their instruction to the next arm, where it is immediately executed again. Rings and spirals are even harder to kill than simple imps, and they even have a (small) chance of killing warriors not protected against them. The number of arms in an imp ring or spiral must be relatively prime with the size of the core.
  • A quickscanner attempts to catch its opponent early by using a very fast unrolled scanning loop. Quickscanning is an early-game strategy, and always requires some other strategy as a backup. Adding a quickscanning component to a warrior can improve its score against long warriors — such as other quickscanners. However, the unrolled scan can only target a limited number of locations, and is unlikely to catch a small opponent.
  • A core clear is a simple warrior that sequentially overwrites every instruction in the core, sometimes even including itself. Core clears are not very common as stand-alone warriors, but they are often used as an end-game strategy by bombers and scanners.
  • A bomb-dodger is a specialized strategy against bombers. It scans the core until it locates a bomb thrown by the bomber, and then copies its code there, assuming that the bomber won't attack the same spot again any time soon.

Core War Programming

Based on the understanding of Core War strategies, a programmer can create a warrior to achieve certain goals. The warrior is saved in ASCII format, with a ".red" extension. Revolutionary ideas come once in a while; most of the time, however, programmers utilize the published warriors to get some ideas. Using optimizers such as OptiMax or core-step optimizer tools, a more compact and efficient warrior can be created.

Warriors can also be generated by Genetic Algorithms or Genetic Programming. Programs that integrate this evolutionary technique are also known as Core War Evolvers. Several small and fast evolvers were introduced by Core War community but were more focused on tiny or nano Core War settings. The latest evolver with significant success was µGP[22] which produced nano and tiny KOTHs. Nevertheless, evolutionary strategy still need to prove its effectiveness in bigger hills (9000 or more cores).[23]


  • CoreWars 8086 implements a game very similar to the original Core War. Instead of using the customized instruction set of Redcode, CoreWars 8086 warrior programs are written in 8086 assembly language.
  • Tierra is an adaptation of Core War, written by Thomas S. Ray (an early member of the ICWS), used in the modeling of living systems.
  • Avida is a further derivative of Core War, building upon Tierra, and abstracting further the processes of evolution. Avida, created by Christoph Adami, Charles Ofria, and Titus Brown, is used in scientific research about evolution.

See also

Gamepad.svg Video games portal


  1. ^ Shoch and Hupp (CACM, vol. 25, no. 3, 1982) from PARC
  2. ^ Dewdney, A. K. (May 1984). "In the game called Core War hostile programs engage in a battle of bits.". Scientific American. Retrieved 2008-11-18. 
  3. ^ Jones, D. G.; Dewdney, A. K. (March 1984). "Core War Guidelines". Retrieved 19 November 2008. 
  4. ^ Dewdney, A. K. (March 1985). "A Core War bestiary of viruses, worms and other threats to computer memories.". Scientific American. Retrieved 2008-11-18. 
  5. ^ Dewdney, A. K. (January 1987). "A program called MICE nibbles its way to victory at the first Core War tournament.". Scientific American. Retrieved 2008-11-18. 
  6. ^ Doligez, Damien; Durham, Mark (8 November 1995). "Annotated Draft of the Proposed 1994 Core War Standard". Retrieved 19 November 2008. 
  7. ^ Metcalf, J. A.. "A Brief History of Corewar". Retrieved 19 November 2008. 
  8. ^
  9. ^ Forth Interpreter in Redcode FORTH interpreter in Redcode
  10. ^ Happy Numbers in Redcode Happy Numbers in Redcode
  11. ^
  12. ^ Mintarjo, W. "Intro to Art in '88: Paper - Stone - Scissors Trilogy."
  13. ^
  14. ^
  15. ^ The First International Core War Tournament
  16. ^
  17. ^ Replicators? - Phoenix & TimeScape source
  18. ^ Metcalf, J. A. "Anatomy of the Scanner, A Basic Introduction."
  19. ^
  20. ^
  21. ^
  22. ^ MicroGP MicroGP page from CAD Group, Politecnico di Torino
  23. ^ Bvowk, Sasha & Fizmo: An Evolutionary Approach Generates Human Competitive Corewar Programs
  24. ^

External links

Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • Core War — est un jeu de programmation dans lequel deux programmes informatiques (ou plus) sont en concurrence pour le contrôle d une machine virtuelle appelée MARS, pour Memory Array Redcode Simulator. Ces programmes sont écrits dans un langage d… …   Wikipédia en Français

  • Core War — Saltar a navegación, búsqueda Core War es un juego de programación en donde combaten entre sí programas escritos en un lenguaje similar al ensamblador con el objetivo de ocupar toda la memoria de la máquina eliminando así a los oponentes. El… …   Wikipedia Español

  • Core War — (Guerra nuclear en español) es un juego de programación en donde combaten entre sí programas escritos en código máquina con el objetivo de ocupar toda la memoria de la máquina eliminando así a los oponentes. El primer sistema de este tipo se… …   Enciclopedia Universal

  • Core War — Bildschirmfoto von Core War Core War (Krieg der Kerne) ist ein Programmierspiel, bei dem zwei oder mehr Programme, die in einer simplen, assemblerartigen Sprache namens Redcode geschrieben sind, im selben Speicherraum gegeneinander antreten.… …   Deutsch Wikipedia

  • Core War — ● n. pl. ►JEU Par analogie avec le film Star Wars , on trouve souvent Core Wars . Jeu entre des programmes en langage assembleur (il s appelle Redcode) dans une machine simulée (i.e. virtuelle, qui s appelle MARS) où l objectif est de détruire le …   Dictionnaire d'informatique francophone

  • Core War — …   Википедия

  • Core Design — Limited Rechtsform Limited Gründung 1988 (aus Gremlin Derby) Auflösung …   Deutsch Wikipedia

  • Core Tex Records — is a punk and hardcore record label based in the Kreuzberg district of Berlin, Germany. It was established in 1988 . Core Tex has become a centre for live music, playing host to a string of in store live events as well as participating in an… …   Wikipedia

  • Core-periphery — theory is based on the notion that as one region or state expands in economic prosperity, it must engulf regions nearby to ensure ongoing economic and political success. The area of high growth or former high growth becomes known as the core, and …   Wikipedia

  • Core Design — Former type Defunct Industry Computer and video game industry Fate Acquired by Eidos Successor …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”