📖 CoreWar Introduction Guide
Redcode-94 Rules
Redcode-94 Specification
Redcode-94 is the standardized instruction set for CoreWar, established by the ICWS (International Core War Society).
Instruction Format
Every Redcode instruction has the form:
OPCODE.MODIFIER A-MODE A-VALUE, B-MODE B-VALUEExample: MOV.I $0, $1 — Copy the entire instruction at relative address 0 to relative address 1.
Addressing Modes
| Symbol | Name | Description |
|---|---|---|
# | Immediate | The value itself (literal number) |
$ | Direct | Relative address (default if omitted) |
@ | B-Indirect | Address stored in the B-field of the target |
< | B-Pre-decrement | Decrement B-field of target, then use as indirect |
> | B-Post-increment | Use B-field as indirect, then increment it |
* | A-Indirect | Address stored in the A-field of the target |
{ | A-Pre-decrement | Decrement A-field of target, then use |
} | A-Post-increment | Use A-field as indirect, then increment |
Modifiers
| Modifier | Description |
|---|---|
.A | Operate on A-fields only |
.B | Operate on B-fields only |
.AB | Source A-field, destination B-field |
.BA | Source B-field, destination A-field |
.F | Both fields independently |
.X | Cross-fields (A→B, B→A) |
.I | Entire instruction |
Execution Model
- Each warrior starts with one process
- Processes execute in round-robin order
- The MARS alternates between warriors
SPLcreates new processes (added to end of queue)DATexecution terminates a process- A warrior loses when its process queue is empty
Default Modifiers
When no modifier is specified, default modifiers are applied based on the opcode and addressing modes. For example:
MOVwith immediate source →.ABMOVwith non-immediate →.IADD,SUBwith immediate →.AB
Core Parameters
| Parameter | Typical Value |
|---|---|
| Core Size | 8000 cells |
| Max Cycles | 80,000 |
| Max Processes | 8000 per warrior |
| Max Warrior Length | 100 instructions |
| Min Separation | 100 cells |