COREWAR

/
Step 23: Finding Enemies with Conditional Skip "SEQ / CMP"
🎯Detect and destroy the enemy at Cell 0400 with your Scanner(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
P1: 0
P2: 0
CYC: 0
📖 LECTURE NOTE // STEP 23 OF 30Chapter 4: Warrior Dissection, Multitasking & Sensors⏱ 5 min read
📖 Lecture Note: Computer Science & Artificial Life Principles Behind This Experiment

Sensory Organs ("SEQ / CMP") and Conditional Branching: From Blind Bombing to Precision Sniping

How comparing two memory cells and conditionally skipping the next instruction endows digital organisms with vision

#SEQ / CMP (Compare)#Conditional Branching#Skip-Next-Instruction#Closed-Loop Feedback#Scanner Archetype
🔬Step 23: Finding Enemies with Conditional Skip "SEQ / CMP"

While Dwarf throws bombs blindly into empty space, a Scanner possesses eyes (the comparison instruction SEQ / CMP)!

Line 2 (SEQ.I @3, $4) compares: - The remote cell pointed to by @3 against the blank DAT #0, #0 template at $4. - If they are equal (empty memory), it skips line 3 (MOV attack)! - If they differ (enemy detected!), it does NOT skip—it executes line 3 (MOV) to snipe the enemy!

🎯 Your Task The scan step A (Left Value) on row 0000 is currently #0. Change it to #8 and press [PLAY] to scan ahead, spot the enemy at 0400, and snipe it!

1. Blind Bombers (Open-Loop) vs. Ocular Scanners (Closed-Loop)

The Dwarf bomber you mastered in Steps 19–21 is relentless, yet completely blind. It possesses no sensory instructions; whether a target cell contains an enemy warrior or empty space ("DAT #0, #0"), Dwarf spends a full clock cycle firing a MOV bomb into it anyway. In control theory, a system that acts without observing its environment is called an Open-Loop system.

In Step 23, you observed an evolutionary leap: the Scanner, equipped with an optical sensory organ—the comparison instruction "SEQ" (Skip if Equal, historically written as "CMP"). - First, the Scanner peers into a distant memory cell. - If that cell is identical to an empty "DAT #0, #0" box, the Scanner SKIPS the "MOV" attack line entirely—saving precious clock cycles and immediately moving on to check the next address! - Only when the distant cell differs from empty memory (meaning an enemy instruction has been spotted!) does the Scanner execute the "MOV" line to snipe the target! In control engineering and cybernetics, using sensory feedback to conditionally trigger action is the hallmark of a Closed-Loop intelligent system.

[0000] ADD.AB #8, $4   ──► 1. Advance scan pointer by +8
[0001] SEQ.I  @3, $4   ──► 2. Compare remote cell (@3) with blank DAT ($4 = [0005])
         │
         ├── If EQUAL (Empty space) ──► SKIP Line 0002! Jump straight to [0003] JMP!
         └── If NOT EQUAL (Enemy!)  ──► Do NOT skip! Execute [0002] MOV to snipe!
[0002] MOV.I  $3, @2   ──► 3. Snipe the detected enemy with a DAT bomb!
[0003] JMP.A $-3, #0   ──► 4. Repeat scan loop

2. Hardware Architecture of "Skip-Next" Conditional Branching

How does a processor implement a high-level "if (A == B)" statement at the machine code level? In the ICWS-94 architecture, comparison instructions like "SEQ.I A, B" (Skip if Equal) and "SNE.I A, B" (Skip if Not Equal) operate by controlling the Program Counter increment at the end of the cycle: - The ALU fetches the entire instruction word (.I) pointed to by Operand A and compares it against the instruction word pointed to by Operand B. - If the two cells are EQUAL, instead of incrementing the Program Counter by the normal +1, the CPU increments the Program Counter by +2—leaping clean over the very next line of code! - If the two cells are NOT EQUAL, the Program Counter increments by the normal +1, executing the line immediately below.

This exact "Skip-Next-Instruction" branching mechanism was used in iconic historical computers (such as the PDP-8 and PIC microcontrollers) and inspired predicated execution in ARM processors. With a single instruction, "SEQ.I @3, $4" acts as a gatekeeper right above the "MOV" trigger: when scanning empty space, the gate stays closed (skipping MOV); the instant an enemy cell is seen, the gate opens and fires!

3. Tuning Scan Stride and Target Alignment

In Step 23, changing the scan stride on row 0000 from "#0" to "#8" added 8 to the pointer box at Address 0004 (initially #388, becoming #396). When Line 2 ("SEQ.I @3, $4") dereferenced that pointer at 0004, it inspected Address 0004 + 396 = Address 0400, spotted the enemy's "JMP" instruction, refused to skip Line 3, and sniped Address 0400 with a DAT bomb!

Notice one subtle detail in the Scanner's anatomy: why does "SEQ.I @3, $4" at row 0001 compare the remote cell "@3" against "$4" (which is Row 0005: "DAT.F #0, #0") instead of comparing it against the pointer box at Row 0004? Because untouched empty memory across the Arena is filled with "DAT.F #0, #0"! Row 0005 serves as a pristine "blank memory reference sample". By comparing remote cells against Row 0005 with the ".I" (full instruction) modifier, any cell containing a non-DAT opcode or any non-zero number immediately registers as a mismatch—triggering an instant snipe. Notice the elegance of this sensor design: while a blind Dwarf spends 3 cycles per address (ADD, MOV, JMP) whether an enemy is there or not, a Scanner inspecting empty space skips the MOV and spends only 3 cycles per empty check while saving its destructive ammunition exclusively for verified targets.

🔒

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