Core Wars
   HOME

TheInfoList



OR:

''Core War'' is a
programming game A programming game is a video game that incorporates elements of computer programming, enabling the player to direct otherwise autonomous units within the game to follow commands in a domain-specific programming language, often represented as a ...
introduced in 1984 by D. G. Jones and
A. K. Dewdney Alexander Keewatin Dewdney (August 5, 1941 – March 9, 2024) was a Canadian mathematician, computer scientist, author, filmmaker, and conspiracy theorist. Dewdney was the son of Canadian artist and author Selwyn Dewdney and art therapist Irene D ...
. In the game, two or more battle programs, known as ''warriors'', compete for control of a
virtual computer Founded by Alex Vasilevsky, Virtual Computer was a venture-backed software company in the Boston area that produces desktop virtualization products, which combine centralized management with local execution on a hypervisor running on PCs. By r ...
. These programs are written in an abstract
assembly language In computing, assembly language (alternatively assembler language or symbolic machine code), often referred to simply as assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence bet ...
called ''Redcode''. Initial standards for Redcode and the virtual machine were established by the International Core Wars Society (ICWS), with later revisions shaped by community consensus.


Gameplay

At the start of a match, each warrior is loaded into a random memory location. Programs take turns executing one instruction at a time. A program wins by terminating all opponents, typically by causing them to execute invalid instructions, leaving the victorious program in sole possession of the machine. Early versions of Redcode featured only eight instructions. This number increased to 10 in the ICWS-86 standard, 11 in ICWS-88, and 16 in the 1994 draft standard, which is still widely used. With various
addressing mode Addressing modes are an aspect of the instruction set architecture in most central processing unit (CPU) designs. The various addressing modes that are defined in a given instruction set architecture define how the machine language instructions ...
s and instruction modifiers introduced in the 1994 draft, the total number of possible operations is 7168. Redcode does not define how instructions are represented in memory, nor does it allow programs to inspect their own code structure beyond copying and equality comparisons. Arithmetic operations are limited to the instruction’s two address fields. ;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. ;Circular memory: The memory is addressed in units of one instruction. The memory space (or ''core'') is of finite size, but 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. The maximum address value is set to equal one less than the number of memory locations and will wrap around if necessary. As a result, there is a one-to-one correspondence between addresses and memory locations, but it is impossible for a Redcode program to determine any absolute address. A process that encounters no invalid or jump instructions will continue executing successive instructions endlessly, eventually returning to the instruction where it started. ;Low-level multiprocessing: Instead of a single
instruction pointer The program counter (PC), commonly called the instruction pointer (IP) in Intel x86 and Itanium microprocessors, and sometimes called the instruction address register (IAR), the instruction counter, or just part of the instruction sequencer, is ...
a Redcode simulator has a ''process queue'' for each program containing a variable number of instruction pointers which the simulator cycles through. Each program starts with only one process, but new processes may be added to the queue using the SPL instruction. A process dies when it executes a instruction or performs a division by zero. A program is considered dead when it has no more processes left. ;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 inspections and modification of the memory while the simulation is running.


Versions of Redcode

A number of versions of Redcode exist. The earliest version described by
A. K. Dewdney Alexander Keewatin Dewdney (August 5, 1941 – March 9, 2024) was a Canadian mathematician, computer scientist, author, filmmaker, and conspiracy theorist. Dewdney was the son of Canadian artist and author Selwyn Dewdney and art therapist Irene D ...
differs 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 rec.games.corewar
newsgroup A Usenet newsgroup is a repository usually within the Usenet system for messages posted from users in different locations using the Internet. They are not only discussion groups or conversations, but also a repository to publish articles, start ...
.


Strategy

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. ;Paper (or replicator): A replicator 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. :A silk is a special type of very rapid replicator, named after ''Silk Warrior'' 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. ;Scissors (or scanner): A scanner is designed to beat replicators. A scanner does not 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. A scanner usually bombs memory with instructions. This causes the enemy to create a huge number of processes which do nothing but create more processes, slowing down useful processes. When the enemy becomes so slow that it is unable to do anything useful, the memory is then bombed with instructions. Scanners are also generally more complex, and therefore are larger and more fragile, than other types of warriors. :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'' by Roy van Rijn is an example of a oneshot. ;Stone (or bomber): A bomber blindly copies a "bomb" at regular intervals in the core, hoping to hit the enemy. The bomb is often a 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 to gain extra resiliency against replicators. ;Vampire (or pit-trapper): A vampire 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. ''myVamp'' by Paulsson is an example of a vampire. ;Imp: Imps are named after the first ever published warrior, ''Imp'' by
A. K. Dewdney Alexander Keewatin Dewdney (August 5, 1941 – March 9, 2024) was a Canadian mathematician, computer scientist, author, filmmaker, and conspiracy theorist. Dewdney was the son of Canadian artist and author Selwyn Dewdney and art therapist Irene D ...
, a trivial one-instruction mobile warrior that continually copies its sole instruction just ahead of its
instruction pointer The program counter (PC), commonly called the instruction pointer (IP) in Intel x86 and Itanium microprocessors, and sometimes called the instruction address register (IAR), the instruction counter, or just part of the instruction sequencer, is ...
. 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 warriors are 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 instructions 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 In number theory, two integers and are coprime, relatively prime or mutually prime if the only positive integer that is a divisor of both of them is 1. Consequently, any prime number that divides does not divide , and vice versa. This is equiv ...
with the size of the core. Hydra Hydras launch multiple copies of tiny bombers or core clears. ;Quickscanner (or q-scan): 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. Bootstrap Bootstraps copy one or more of it's components away from their original location, leaving a decoy to attract Scanners and Quickscanners. ;Core clear: A core clear sequentially overwrites every instruction in the core, sometimes even including itself. Core clears are not very common as stand-alone warriors, but are often used as an end-game strategy by bombers and scanners.


''Core War'' programming

With an understanding of ''Core War'' strategies, a programmer can create a warrior to achieve certain goals. Revolutionary ideas come once in a while; most of the time, however, programmers base their programs on already published warriors. Using optimizers such as OptiMax or core-step optimizer tools, a more effective warrior can be created. Warriors can also be generated by
genetic algorithm In computer science and operations research, a genetic algorithm (GA) is a metaheuristic inspired by the process of natural selection that belongs to the larger class of evolutionary algorithms (EA). Genetic algorithms are commonly used to g ...
s or
genetic programming Genetic programming (GP) is an evolutionary algorithm, an artificial intelligence technique mimicking natural evolution, which operates on a population of programs. It applies the genetic operators selection (evolutionary algorithm), selection a ...
. Programs that integrate this evolutionary technique are known as ''evolvers''. Several evolvers were introduced by the ''Core War'' community and tend to focus on generating warriors for smaller core settings. The latest evolver with significant success was ''μGP'' which produced some of the most successful nano and tiny warriors. Nevertheless, evolutionary strategy still needs to prove its effectiveness on larger core settings.


Development

''Core War'' was inspired by a
self-replicating Self-replication is any behavior of a dynamical system that yields construction of an identical or similar copy of itself. Cell (biology), Biological cells, given suitable environments, reproduce by cell division. During cell division, DNA repli ...
program called Creeper and a subsequent program called Reaper that destroyed copies of Creeper. Creeper was created by Bob Thomas at BBN. Dewdney was not aware of the origin of Creeper and Reaper and refers to them as a rumor originating from Darwin and the worm experiments of Shoch and Hupp. The 1984 ''
Scientific American ''Scientific American'', informally abbreviated ''SciAm'' or sometimes ''SA'', is an American popular science magazine. Many scientists, including Albert Einstein and Nikola Tesla, have contributed articles to it, with more than 150 Nobel Pri ...
'' article on ''Core War'' nevertheless cites the game '' Darwin'', played by
Victor A. Vyssotsky Victor Alexander Vyssotsky (February 26, 1931 – December 24, 2012) was a mathematician and computer scientist. He was the technical head of the Multics project at Bell Labs and later executive director of Research in the Information Systems Divi ...
, Robert Morris, and
Douglas McIlroy Malcolm Douglas McIlroy (born 1932) is an American mathematician, engineer, and programmer. As of 2019 he is an Adjunct Professor of Computer Science at Dartmouth College. McIlroy is best known for having originally proposed Unix pipelines and de ...
at
Bell Labs Nokia Bell Labs, commonly referred to as ''Bell Labs'', is an American industrial research and development company owned by Finnish technology company Nokia. With headquarters located in Murray Hill, New Jersey, Murray Hill, New Jersey, the compa ...
in 1961. The word "Core" in the name comes from
magnetic-core memory In computing, magnetic-core memory is a form of random-access memory. It predominated for roughly 20 years between 1955 and 1975, and is often just called core memory, or, informally, core. Core memory uses toroids (rings) of a hard magneti ...
, an obsolete
random-access memory Random-access memory (RAM; ) is a form of Computer memory, electronic computer memory that can be read and changed in any order, typically used to store working Data (computing), data and machine code. A random-access memory device allows ...
technology. This term was then, and still today, typically in use as the term for working memory in working memory dumps, called core dumps, on Unix and most Unix-like systems. Additionally, the default filename used for core dumps on such systems is usually "core" or contains the word core. The first description of the Redcode language was published in March 1984, in ''Core War Guidelines'' by D. G. Jones and
A. K. Dewdney Alexander Keewatin Dewdney (August 5, 1941 – March 9, 2024) was a Canadian mathematician, computer scientist, author, filmmaker, and conspiracy theorist. Dewdney was the son of Canadian artist and author Selwyn Dewdney and art therapist Irene D ...
. 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, and again in January 1987. 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. Nonetheless, the 1994 draft was commonly adopted and extended, and forms the basis of 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.


Redcode

0000: ADD.AB # 4, $ 3 0001: MOV.F $ 2, @ 2 0002: JMP.B $ -2, $ 0 0003: DAT.F # 0, # 0
Redcode is the
programming language A programming language is a system of notation for writing computer programs. Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
used in ''Core War''. It is executed by a
virtual machine In computing, a virtual machine (VM) is the virtualization or emulator, emulation of a computer system. Virtual machines are based on computer architectures and provide the functionality of a physical computer. Their implementations may involve ...
known as a ''Memory Array Redcode Simulator'', or ''MARS''. The design of Redcode is loosely based on actual CISC
assembly language In computing, assembly language (alternatively assembler language or symbolic machine code), often referred to simply as assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence bet ...
s of the early 1980s, but contains several features not usually found in actual computer systems. 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 is quite simplified relative to "real" assembly, and has no absolute memory addressing The original 8 instructions are described as follows. Later versions added NOP, multiply and more complex comparisons. The ICWS '94 draft standard added more addressing modes, mostly to deal with A-field indirection, to give a total of 8 modes:


Implementations

Development of implementations of the game continued over the years by several authors. There are multiple versions of the game available,
ported In software engineering, porting is the process of adapting software for the purpose of achieving some form of execution in a computing environment that is different from the one that a given program (meant for such execution) was originally desig ...
for several platforms. For instance ''pMARS'' which is
open source software Open-source software (OSS) is Software, computer software that is released under a Open-source license, license in which the copyright holder grants users the rights to use, study, change, and Software distribution, distribute the software an ...
with
source code In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer. Since a computer, at base, only ...
on
SourceForge SourceForge is a web service founded by Geoffrey B. Jeffery, Tim Perdue, and Drew Streib in November 1999. SourceForge provides a centralized software discovery platform, including an online platform for managing and hosting open-source soft ...
, or the SDL based ''SDL pMARS'' for Windows. The common implementation pMars was downloaded over 35,000 times between 2000 and 2021 from
SourceForge SourceForge is a web service founded by Geoffrey B. Jeffery, Tim Perdue, and Drew Streib in November 1999. SourceForge provides a centralized software discovery platform, including an online platform for managing and hosting open-source soft ...
.download numbers corewar
on
SourceForge SourceForge is a web service founded by Geoffrey B. Jeffery, Tim Perdue, and Drew Streib in November 1999. SourceForge provides a centralized software discovery platform, including an online platform for managing and hosting open-source soft ...
(access 2021-06-07)


References

{{Reflist, 30em


External links


Core War - the Ultimate Programming Game

The Core War Info Page






1984 video games Programming games Artificial life models Programming contests Digital organisms Open-source video games Video games with available source code Freeware games Linux games Windows games Video games developed in Canada