Domain: Engineering — Computer Science
Target concept: Principle Demonstration of Array Deduplication (Two-Pointer Method)

Video generation prompt: A simple animation on a light background displays an array of numbers arranged horizontally (e.g., `[1, 1, 2, 2, 3, 3, 4]`), which contains duplicate elements. Two colored pointers move from left to right, labeled slow (blue) and fast (red), to demonstrate the two-pointer approach for removing duplicates from an array.

Evaluation guide:
Target concept: In-place array deduplication via two-pointer technique, where ‘slow’ maintains the boundary of the unique prefix, and ‘fast’ discovers next unique element. Minimum mechanistic assumptions: (1) array is sorted and contains duplicates; (2) comparison is value-based (nums[i] != nums[j]); (3) assignment is in-place (nums[++slow] = nums[fast]). Expected phenomena storyline: (Phase 1) Initialization: slow=0 (on first 1), fast=1 (on second 1); (Phase 2) Comparison & Skip: fast sees duplicate → no slow move; (Phase 3) First Uniqueness: fast reaches index 2 (value 2) ≠ nums[slow]=1 → slow increments to 1, assigns 2; (Phase 4) Repeat: fast continues, slow advances at each new unique value (3, then 4); (Phase 5) Termination: slow stops at index 3 → final length=4. Visibility constraints: All pointers, labels, array values, and comparison symbols must be simultaneously legible; no occlusion; light background ensures contrast; motion must be directional (left→right) and temporally ordered; verification requires frame-accurate alignment of pointer positions with array indices and explicit cause-effect markers (≠, increment, assign).

Manual:
I. Basic Demonstration Information
Demonstration Title: Principle Demonstration of Array Deduplication (Two-Pointer Method)
Subject: Engineering - Computer Science - Algorithms & Data Structures
Demonstration Purpose: To visually demonstrate the in-place array deduplication algorithm using the two-pointer technique, clarifying the roles of the slow (blue) and fast (red) pointers, their coordinated movement logic, and how uniqueness is preserved in the leftmost segment of the array.

II. Demonstration Carrier/Equipment
Core Carrier: Animated SVG/Canvas rendering engine (light background: #FFFFFF or #F8F9FA)
Auxiliary Elements: Horizontal array display (e.g., [1, 1, 2, 2, 3, 3, 4]), two labeled pointers (slow: solid blue circle + ‘slow’ label; fast: solid red circle + ‘fast’ label), numeric labels under each array element showing indices (0–6).

III. Demonstration Content Description
Layout: Array centered horizontally on light background; numbers evenly spaced (≥60px apart); pointers rendered as filled circles (radius ≥8px) positioned directly above corresponding array elements; labels in 14pt sans-serif, aligned bottom-center below each pointer.
State Control: Animation runs once, duration ≤10s; starts with slow at index 0, fast at index 1; fast moves sequentially rightward; slow advances only when nums[fast] ≠ nums[slow]; upon advance, nums[slow+1] is updated to nums[fast] (visualized as number replacement or fade-in).
Comparison Baseline: Initial array must contain contiguous duplicates (e.g., [1,1,2,2,3,3,4]) to emphasize scanning vs. anchoring behavior.

IV. Observation of Core Phenomena
Pointer Color & Label Fidelity: Slow pointer is consistently blue (#1E90FF) with visible ‘slow’ label; fast pointer is consistently red (#DC2F02) with visible ‘fast’ label — no color swap or label omission.
Motion Logic: Fast pointer moves strictly left-to-right, visiting each index 1 through 6; slow pointer remains stationary until inequality triggers — then advances *exactly one step*, then receives fast’s value. No backward motion or skipping.
Deduplication Outcome: Final stabilized prefix (e.g., indices 0–3 containing [1,2,3,4]) is visually distinguished (e.g., bold font, green highlight, or subtle underline); trailing elements (indices 4–6) appear dimmed, grayed, or marked ‘redundant’.
Visual Verification Features: (1) Simultaneous highlight of nums[slow] and nums[fast] during comparison; (2) ≠ symbol appears between them on inequality; (3) slow pointer advances *before* value assignment; (4) final length (slow+1) displayed numerically at bottom.

V. Summary of Key Knowledge Points and Principles
Core Concept Definition: Two-pointer deduplication is an in-place O(n) time, O(1) space algorithm that uses a ‘slow’ pointer to track the end of the deduplicated subarray and a ‘fast’ pointer to scan for new unique values.
Mechanistic Principle: The slow pointer maintains the invariant that nums[0..slow] contains only unique, sorted elements; fast extends the search space, and each time nums[fast] differs from nums[slow], the invariant is extended by incrementing slow and copying nums[fast].
Why It Works: By never overwriting nums[0..slow], the algorithm preserves the deduplicated prefix while reusing memory — no auxiliary array needed.

VI. Demonstration Precautions
Timing Constraint: Entire animation must complete within 10 seconds — accelerate non-essential transitions (e.g., pointer movement between adjacent indices <150ms), but preserve causal order and state visibility.
Clarity Priority: Avoid decorative effects (particles, shadows, sound); prioritize legibility of numbers, pointer colors, labels, and comparison events.
Verification Anchor: Frame-by-frame inspection must confirm: (i) slow never moves without inequality trigger; (ii) fast never skips indices; (iii) all assignments occur *after* slow increment; (iv) final length matches count of unique values.

Prompt Grounding rubric:
level_1: No horizontal array of numbers is shown at all, or the scene has no light background, or neither a blue 'slow' pointer nor a red 'fast' pointer appears anywhere; the visual is unrelated to the described array-deduplication setup (e.g., a 3D scene, dark theme, vertical list, or text-only screen).
level_2: A horizontal array such as [1, 1, 2, 2, 3, 3, 4] is shown, but on a dark or strongly colored background; or two pointers appear but are the same color or unlabeled, so 'slow' cannot be told apart from 'fast'; or one pointer never moves at all while the other does.
level_3: A horizontal array with duplicate values (e.g., [1, 1, 2, 2, 3, 3, 4]) sits on a light background; two pointers move left to right across it; but the 'slow'/'fast' labels are missing, swapped, or mismatched with pointer color (e.g., the label 'fast' sits next to the blue pointer).
level_4: Light background; horizontal array with duplicate integers (e.g., [1, 1, 2, 2, 3, 3, 4]) shown along its full length; two pointers are present throughout, one consistently blue and labeled 'slow,' the other consistently red and labeled 'fast'; both move left to right; minor flaws such as brief label-number overlap or slight jitter in a pointer's path do not block reading either pointer's position.
level_5: Clean, uncluttered light background; the array [1, 1, 2, 2, 3, 3, 4] is laid out left to right with clearly spaced integers; a blue pointer labeled 'slow' and a red pointer labeled 'fast' are visible in every frame, each staying its assigned color and adjacent to its own label; both pointers move smoothly left to right; no extraneous objects, no camera cut, and no moment where either pointer, its label, or an array value is hidden or unreadable.

Scientific and Causal Correctness rubric:
level_1: The array values change with no link to the pointers' positions at all: elements vanish, shift, or duplicates are removed while the pointers sit still or move randomly; or slow moves before fast ever reaches a new value; or slow copies the same value into its position repeatedly with no new comparison shown.
level_2: Array entries change or disappear, but not because of pointer actions (e.g., the whole array rewrites at once instead of index by index); or only the fast pointer appears to cause any change while the slow pointer never anchors a value; or the fast pointer is ever shown lagging behind or crossing back past the slow pointer's position.
level_3: The slow pointer visibly holds at a unique value (e.g., the first '1', then the first '2') while the fast pointer scans ahead across the remaining indices; the front portion of the array (building toward [1, 2, 3, 4]) becomes visually distinguished from the trailing duplicates; the fast pointer's index stays at or ahead of the slow pointer's index throughout, but the comparison step itself (why a given value is skipped or copied) is not clearly shown.
level_4: The comparison driving each action is visible: the fast pointer pauses at each new index and its value is visibly compared to the slow pointer's current value; whenever they differ, the slow pointer advances and takes on the fast pointer's value; the gap between the fast and slow pointer indices never shrinks: it only grows or stays the same as fast moves ahead; the deduplicated front segment (eventually [1, 2, 3, 4]) is clearly set apart from the trailing duplicates, and every step follows in forward order with none skipped or reversed.
level_5: Every frame matches the two-pointer deduplication rule for this array: fast steps through indices 1 through 6 in order, slow starts at index 0, and slow only advances (and copies fast's value into place) exactly when the two values differ; the fast-to-slow index gap never decreases, only widens or holds steady, as fast pulls ahead; the comparison, the advance, and the value copy always occur in that order with no step skipped; the final unique run [1, 2, 3, 4] is clearly marked apart from the discarded duplicates, matching a final length of 4.

Spatiotemporal Consistency rubric:
level_1: Pointers jump instantly from one array index to another with no visible travel path; the whole array re-renders or re-positions mid-animation; a pointer's label detaches and floats away from its pointer; motion visibly runs backward or freezes then jumps forward; the background flickers or changes brightness abruptly.
level_2: A pointer's movement is jerky or curved instead of a steady horizontal path; array numbers shift position or spacing without any stated reason; a label drifts noticeably away from its pointer or lags behind it; the background shifts tone partway through the clip; spacing between array elements changes inconsistently.
level_3: Both pointers move left to right at a steady, even pace; the array stays fixed in place and size; each label stays near its own pointer; there may be brief moments where a label is partly covered by a number, or a pointer's position looks a little off from the array element it should be sitting over, but the overall path and pace stay smooth and continuous.
level_4: Each pointer's marker sits clearly over its intended array element throughout its motion; each label stays attached to its pointer with a consistent offset and orientation; the array's spacing never changes; the background stays completely still; both pointers move at a constant, smooth speed with no visible speeding up, slowing down, or skipped frames.
level_5: Motion and layout stay fully consistent from start to finish: the pointer markers track their array elements with no visible drift at any point; the frame pacing looks constant with no stutter or skipped steps; the array, pointers, and labels all sit in the same flat layout with no added depth, unexpected scaling, or layering errors; nothing in the scene jumps, misaligns, or flickers across the entire clip.