COREWAR

/
Step 20: Modifying Dwarf (Changing the Bombing Interval)
🎯Land a DAT bomb on Cell 0005(0/1)

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
🟢 EDIT MODE (Click cells to modify)
[Addr][Opcode][A (Left)][B (Right)]
📦 DATA / BOMB (DAT)
0000
▼MOV
#
$
👈 EDIT
0001
▼MOV
<
<
0002
↺JMN
$
$
0003
❖SPL
@
#
0004
+ADD
#
$
0005
↺JMP
$
$
0006
■DAT
$0
$0
++ ADD ROW
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 20 OF 30Chapter 4: Warrior Dissection, Multitasking & Sensors⏱ 5 min read
📖 Lecture Note: Computer Science & Artificial Life Principles Behind This Experiment

Modular Arithmetic and Greatest Common Divisors (GCD): The Mathematics of Bombing Stride

How changing the bombing interval from #4 to #2 alters spatial coverage density, sweep speed, and modular periodicity

#Modulo Arithmetic#Greatest Common Divisor (GCD)#Step Size (Stride)#Coverage Density vs Speed#Mod-N Bombing
🔬Step 20: Modifying Dwarf (Changing the Bombing Interval)

Dwarf's bombing interval is controlled by #4 in ADD.AB #4, $3 on line 1 (0000). With #4, bombs land on 0007 and 0011, skipping right over Address 0005.

🎯 Your Task Change the highlighted A (Left Value) on row 0000 from #4 to #2 and press [PLAY] to carpet-bomb every 2 cells (hitting both 0005 and 0007)!

1. The Fundamental Trade-Off: Mesh Density vs. Sweep Speed

In Step 20, you modified Dwarf's additive stride on row 0000 from "#4" to "#2", tightening its bombing pattern so that bombs landed every 2 cells (0005, 0007, 0009...) instead of every 4 cells.

When designing a bomber in CoreWar, choosing the step size (stride) confronts you with one of the classic optimization trade-offs in search theory: Spatial Density versus Sweep Speed. - A Small Stride (e.g., #2): Casts a very fine net. Any enemy program that is at least 2 lines long is guaranteed to be hit on the very first pass! However, covering an 800-cell arena 2 cells at a time requires 400 shots (1,200 cycles), meaning your bombs travel slowly across space. - A Large Stride (e.g., #8 or #16): Sweeps across the entire arena at lightning speed, reaching distant enemies quickly. However, the wide gaps between bombs leave safe pockets where smaller enemies can hide unscathed.

Stride #4 (Mod-4): [0003] ──► . . . 💥(0007) . . . 💥(0011)  (3-cell safe gap between bombs)
Stride #2 (Mod-2): [0003] ──► . 💥(0005) . 💥(0007) . 💥(0009) (Only 1-cell gap! Dense carpet)

2. The Mathematics of the Ring: The GCD(CoreSize, Step) Theorem

Here we encounter one of the most elegant applications of number theory in computer science. In a circular memory ring of size N (where N = 800 in the Academy and N = 8,000 in the Laboratory), if a pointer advances by a constant step size S on every iteration, which cells will it visit before repeating?

Number theory gives us the exact formula via the Greatest Common Divisor, GCD(N, S): - The minimum gap between visited cells after a full cycle is g = GCD(N, S). - The total number of unique cells visited before the pattern repeats is N / GCD(N, S).

Let's test this theorem on our 800-cell Academy core: - When Step S = 4: GCD(800, 4) = 4. The bomber visits 800 / 4 = 200 unique cells spaced 4 addresses apart (Mod-4 bombing). - When Step S = 2: GCD(800, 2) = 2. The bomber visits 800 / 2 = 400 unique cells spaced 2 addresses apart (Mod-2 bombing).

What if you choose a step size S that is coprime to 800 (meaning GCD(800, S) = 1), such as S = 3, S = 7, or S = 253? Because GCD(800, S) = 1, the pointer will visit ALL 800 cells of memory (800 / 1 = 800) without ever repeating an address until every single cell in the universe has been hit! (Of course, a Mod-1 step will eventually walk right across your own code at 0000–0002 unless you design a self-preservation mechanism, such as switching to a core-clear carpet bomb right before the pointer wraps back onto your own body.)

3. Optimal Step Sizes ("Optima Numbers") in Competitive CoreWar

In competitive CoreWar tournaments on an 8,000-cell core, champion warriors rarely use small sequential steps like #2 or #4. Why? Because a sequential step sweeps memory like a slow windshield wiper—if the enemy happens to spawn at Address 7500, a sequential bomber takes thousands of cycles to reach them.

Instead, tournament designers use mathematically derived constants known as "Optima Step Sizes" (such as #2364 or #3044 for Mod-4 on an 8,000-cell core). Because GCD(8000, 2364) = 4, a step of #2364 still guarantees safe Mod-4 immunity for a 4-line warrior, while scattering bombs evenly across every quadrant of the arena from the very first few shots! Behind that single number in the A-field lies a rich intersection of number theory, linear congruential generators (pseudo-random number theory), and search optimization.

🔒

🔒 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.