COREWAR

/
Step 19: Observation: Dissecting the "Dwarf" Bomber Step-by-Step
🎯Run for 12+ cycles to observe the bombing loop(0/12)

MISSIONS (30 STEPS)

CH.1: UI & MEMORY BASICS (1-6)
BASIC★☆☆
Step 1: The "STEP" Button That Advances Time
🔒
BASIC★☆☆
Step 2: Process Termination and Restoring with "RESET"
🔒
BASIC★☆☆
Step 3: "Edit Mode" vs. "Running Mode"EDIT
🔒
BASIC★☆☆
Step 4: The Three Rooms of a Memory Box (Changing B)EDIT
🔒
BASIC★☆☆
Step 5: Modifying Both the Left Room (A) and Right Room (B)EDIT
🔒
BASIC★☆☆
Step 6: Literal Numbers (#) vs. Relative Addresses ($)EDIT
CH.2: CORE INSTRUCTIONS (7-13)
🔒
ARITHMETIC★☆☆
Step 7: Observing the "ADD" Instruction
🔒
ARITHMETIC★☆☆
Step 8: Changing the Number to Add (A-Field)EDIT
🔒
ARITHMETIC★☆☆
Step 9: Changing the Target Address (B-Field)EDIT
🔒
ARITHMETIC★☆☆
Step 10: Using the Subtraction Instruction "SUB"EDIT
🔒
BASIC★☆☆
Step 11: Copying an Entire Box with "MOV"EDIT
🔒
CONTROL★☆☆
Step 12: Looping Back in Time with "JMP"EDIT
🔒
CONTROL★☆☆
Step 13: Build Your First Program (Automatic Counter)EDIT
CH.3: VON NEUMANN & DIGITAL LIFE (14-18)
🔒
BASIC★☆☆
Step 14: Why Does "DAT" Become a Bomb?EDIT
🔒
BASIC★☆☆
Step 15: Copying Your Own Instruction (Code = Data)EDIT
🔒
BASIC★☆☆
Step 16: Observation: Stepping Through "Imp", the Oldest Digital Organism
🔒
BASIC★☆☆
Step 17: Modifying the Imp (Copy Destination Experiment)EDIT
🔒
ARITHMETIC★★☆
Step 18: Understanding Indirect Addressing (@ Pointers)EDIT
CH.4: CLASSIC ARCHETYPES (19-24)
🔒
STRATEGY★★☆
Step 19: Observation: Dissecting the "Dwarf" Bomber Step-by-Step
🔒
STRATEGY★★☆
Step 20: Modifying Dwarf (Changing the Bombing Interval)EDIT
🔒
STRATEGY★★☆
Step 21: First Combat: Tune Your Bomb Interval to Destroy the TargetEDIT
🔒
CONTROL★★☆
Step 22: Observation: The "SPL" Split Instruction and Mitosis
🔒
CONTROL★★☆
Step 23: Finding Enemies with Conditional Skip "SEQ / CMP"EDIT
🔒
STRATEGY★★☆
Step 24: Stopping an Imp with a Pre-Decrement "Imp-Gate"EDIT
CH.5: BATTLE EVOLUTION (25-30)
🔒
STRATEGY★★☆
Step 25: [Stone] High-Speed Bomber and Step Size TuningEDIT
🔒
STRATEGY★★☆
Step 26: [Paper] Observing the Self-Replicating Swarm "Mice"
🔒
STRATEGY★★★
Step 27: [Modifying Paper] Tune Clone Dispersal Distance to Overwhelm StoneEDIT
🔒
STRATEGY★★☆
Step 28: [Scissors] Tuning Scanner Stride to Shred PaperEDIT
🔒
STRATEGY★★★
Step 29: [Trap] Abducting Enemy Processes with "Vampire"EDIT
🔒
STRATEGY★★★
Step 30: Graduation Exam: Tune Your Warrior and Win the Final BattleEDIT
👁️ OBSERVATION MODE (Press [STEP])
[Addr][Opcode][A (Left)][B (Right)]
📦 DATA / BOMB (DAT)
0000
▼MOV
#
$
0001
▼MOV
<
<
0002
↺JMN
$
$
0003
❖SPL
@
#
0004
+ADD
#
$
0005
↺JMP
$
$
0006
■DAT
$0
$0
0007
■DAT
$0
$0
0008
■DAT
$0
$0
0009
■DAT
$0
$0
0010
■DAT
$0
$0
0011
■DAT
$0
$0
0012
■DAT
$0
$0
0013
■DAT
$0
$0
0014
■DAT
$0
$0
0015
■DAT
$0
$0
0016
■DAT
$0
$0
0017
■DAT
$0
$0
0018
■DAT
$0
$0
0019
■DAT
$0
$0
0020
■DAT
$0
$0
0021
■DAT
$0
$0
0022
■DAT
$0
$0
0023
■DAT
$0
$0
0024
■DAT
$0
$0
0025
■DAT
$0
$0
0026
■DAT
$0
$0
0027
■DAT
$0
$0
🏟️ARENA (20 ROWS)SCOPE: 0000 - 0019
[CORE MEMORY 800 CELLS (20 ROWS × 40 COLS)]1:1 Row Synced with Editor
TASKS: 0
CYC: 0
📖 LECTURE NOTE // STEP 19 OF 30Chapter 4: Warrior Dissection, Multitasking & Sensors⏱ 5 min read
📖 Lecture Note: Computer Science & Artificial Life Principles Behind This Experiment

Dissecting the Legendary "Dwarf" Bomber: Four Lines of Architectural Perfection

How ADD, MOV, JMP, DAT, and "@" indirect pointers crystallize into CoreWar's most iconic four-line predator

#Dwarf (A. K. Dewdney)#Pointer Arithmetic#Dual-Role DAT#3-Cycle Bombing Loop#Self-Preservation
🔬Step 19: Observation: Dissecting the "Dwarf" Bomber Step-by-Step

In Chapter 4, we dissect real combat Warriors! First, observe the complete 4-line classic bomber Dwarf, which combines everything you've learned so far:

1. 0000: ADD.AB #4, $3 ➔ Adds 4 to the B-value of the pointer/bomb box at 0003. 2. 0001: MOV.I $2, @2 ➔ Launches the DAT bomb at 0003 to the address pointed to by @2! 3. 0002: JMP.A $-2, #0 ➔ Jumps back to 0000 to repeat (dropping bombs every 4 cells!). 4. 0003: DAT.F #0, #0 ➔ Serves as both the target pointer and the DAT bomb template.

🎯 Your Task (No Editing Needed) Press [STEP] repeatedly or press [PLAY] to watch Dwarf drop bombs every 4 cells (0007, 0011, 0015...)!

1. Four Lines of Pure Combat Engineering

Opening Chapter 4, Step 19 let you dissect the complete, combat-ready "Dwarf"—the classic four-line bomber introduced alongside the Imp by A. K. Dewdney in 1984.

Dwarf occupies only four cells of memory (Addresses 0000 through 0003), yet those four lines synthesize every concept you mastered across the first eighteen steps into a single interlocking mechanism: - Line 1 (0000): "ADD.AB #4, $3" ➔ THE TARGETING COMPUTER (adds 4 to the B-field of Cell 0003 on every pass to advance the aim). - Line 2 (0001): "MOV.I $2, @2" ➔ THE LAUNCHER (copies the DAT cell at 0003 and hurls it via indirect pointer "@2" to the target address). - Line 3 (0002): "JMP.A $-2, #0" ➔ THE HEARTBEAT (jumps 2 rows back to 0000, sustaining a rapid 3-cycle bombing loop forever). - Line 4 (0003): "DAT.F #0, #0" ➔ THE POINTER & AMMUNITION DEPOT (holds the incrementing target offset: 0, 4, 8, 12...).

┌──► [0000] ADD.AB #4, $3  ──(1. Increments [0003].B: +4, +8, +12...)──┐
│    [0001] MOV.I  $2, @2  ──(2. Fires [0003] to 0003 + [0003].B)──────┼──► 💥 [0007], [0011], [0015]...
└─── [0002] JMP.A $-2, #0  ◄─(3. Loops back to 0000 every 3 cycles)    │
     [0003] DAT.F  #0, #0  ◄─(4. Dual Role: Target Pointer & Bomb!)────┘

2. The Ingenious Dual Role of Cell 0003: Pointer AND Bomb

The most brilliant stroke of engineering in Dwarf lies in how Line 2 ("MOV.I $2, @2") uses Cell 0003 for two completely different jobs at the exact same time: - The Source Operand ("$2") asks: "What should I copy?" Counting 2 rows down from 0001 lands on Address 0003. So MOV picks up Cell 0003 itself as the bomb payload! - The Destination Operand ("@2") asks: "Where should I throw it?" Counting 2 rows down from 0001 ALSO lands on Address 0003, dereferencing its B-value to find the target coordinates!

Thus, the single DAT cell at 0003 serves simultaneously as the aiming pointer AND the ammunition template! Because of this dual role, the first bomb dropped onto Address 0007 is actually "DAT.F #0, #4", the second bomb dropped onto Address 0011 is "DAT.F #0, #8", and the third onto Address 0015 is "DAT.F #0, #12". Regardless of what number sits inside a DAT cell's B-field, any enemy execution pointer that steps onto a DAT opcode dies instantly. Combining the pointer and the bomb into one cell shrinks Dwarf's footprint by 20%, making it a smaller target for enemies to hit.

3. Why Dwarf Never Bombs Itself When Wrapping Around Memory

There is one more piece of mathematical magic hidden inside Dwarf. As Dwarf hurls bombs every 4 cells (0007, 0011, 0015...), its aim eventually wraps all the way around the circular 800-cell (or 8,000-cell) memory core and approaches its own body at 0000–0003. Why doesn't Dwarf accidentally bomb itself to death?

Let's do the modular math! Every bomb lands at an address of the form: Landing Address = (0003 + 4k) mod 800 Because the core size (800 in Academy, 8,000 in Laboratory) is an exact multiple of 4, as the bombs wrap around the top of memory they land on 0795, then 0799, and then (0799 + 4) mod 800 = Address 0003! Dwarf's three executable instructions at 0000, 0001, and 0002 are completely skipped over! The bomb at 0003 simply overwrites Dwarf's existing DAT cell at 0003 with itself, allowing Dwarf to survive its own barrage forever. This mathematical harmony—where a 4-line program uses a Mod-4 bombing step so that its own 3 lines of executable code sit safely inside the 3-cell gap between bombs—is one of the most celebrated examples of modular invariants in recreational computer science.

🔒

🔒 MISSION CLEAR Unlocks the Full Lecture Note

Complete the experiment in the simulator above to automatically unlock the full deep-dive article—or click below to read the full text immediately.