Core War

Core War (or Core Wars) is a game consisting of battles between two or more assembly language programs occupying the same memory space in which the winner is the last one running. Although "core war" can refer to any such event, it is usually taken to mean the game based on the Redcode language that developed a following in part because of A. K. Dewdney's articles in Scientific American on it.

"Core" refers to magnetic core memory, an obsolete technology. Core War programs (called "warriors") are assembled and executed by a program called a Memory Array Redcode Simulator (abbreviated to MARS).

According to the Jargon File, Core War was the idea of Victor Vyssotsky, Robert Morris Sr., and Dennis Ritchie, who wrote a program called "Darwin" in the 1960s. In 1984, Core War Guidelines by A. K. Dewdney and D. G. Jones defined the language Redcode. The International Core War Society (ICWS) updated the language in 1984 and 1988, and proposed a new update in 1994 that was never formally set as the new standard.

Redcode, because it is designed for battle rather than assembly on a real machine, has some differences from "normal" assembly:

  • It uses relative addressing (that is, "0" refers to the currently executing instruction, "-1" refers to the previous one). This way, a program can be randomly placed in the core and not have to know its location.
  • The core (or memory) is circular, so all addresses are taken modulo the coresize.
  • There are many addressing modes for the arguments to be taken as and many instruction modifiers so that each op-code is versitile.
  • Data are stored as arguments to op-codes (usually the DAT op-code), rather than as whole instructions. This makes the instruction modifiers a nessecity.
  • The DAT op-code terminates the current process.
  • The SPL op-code divides the current process into two processes, each executing less frequently.

"Warriors", as the programs are called, are divided into categories, although programmers frequently implement programs with the behavior of two or more of these.

  • A paper copies itself repeatedly, sacrificing speed for durability.
    • Silks are special types of papers that begin execution of the copy before it is finished in order to gain copying speed.
  • A stone systematically "bombs" the core, usually with DAT statements.
  • A scissors employs some sophisticated but slower strategy.
    • A vampire or pit-trapper steals its opponents' processes, usually making them execute SPL statements repeatedly to slow down the remaining processes.
  • An imp can be as simple as the single statement "MOV 0 1", which copies itself one space ahead repeatedly, overwriting whatever code is in front of it. A more sophisticated imp operating on the same principle, like an imp ring or imp spiral is required to actually kill enemy processes, however.

As their names imply papers usually overwhelm stones, stones are effective against scissors, and scissors have an advantage over papers.

See also

External links

copyright 2004