-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlevel8.ts
More file actions
22 lines (20 loc) · 1.93 KB
/
level8.ts
File metadata and controls
22 lines (20 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { Level } from './types';
export const level8: Level = {
id: 8,
title: "Array Sorting: Memory Organization",
description: "Three memory blocks sit in chaos: [5, 2, 8]. In computer science, unsorted data is inefficient - searches are slow (O(n)), lookups are expensive, algorithms fail. Sorting is fundamental: quicksort, mergesort, bubblesort. But at the lowest level, sorting is just memory manipulation - reading values, comparing, swapping. These three integers exist at specific offsets: MEM_BLOCK_A (0xA0), MEM_BLOCK_B (0xA4), MEM_BLOCK_C (0xA8). Your task: sort them into ascending order [2, 5, 8]. Not by writing code. By directly manipulating the bytes. This is how debuggers optimize data structures, how save editors fix corrupted arrays, how exploit developers build ROP chains. Real-world: database indexing, cache optimization, memory defragmentation.",
requiredSkill: "Array Sorting & Data Structure Manipulation",
objective: (s) => s.sortValue1 === 2 && s.sortValue2 === 5 && s.sortValue3 === 8,
hint: "The blocks are out of order. Observe. Compare. Exchange. The smallest must come first. The pattern reveals itself to those who see.",
tutorPersona: "The Oracle: You do not need an algorithm. The answer is already there, hidden in the disorder. Look at the three values. What is the natural sequence? The smallest, then the middle, then the largest. Chaos transformed to order. This is all sorting has ever been - finding what belongs where, and putting it there. The data knows its place. You simply... remind it.",
memoryLayout: [
{ key: 'sortValue1', label: 'MEM_BLOCK_A', type: 'int', offset: 0xA0 },
{ key: 'sortValue2', label: 'MEM_BLOCK_B', type: 'int', offset: 0xA4 },
{ key: 'sortValue3', label: 'MEM_BLOCK_C', type: 'int', offset: 0xA8 }
],
initialState: { sortValue1: 5, sortValue2: 2, sortValue3: 8 },
platforms: [
{ id: 'p1', x: 0, y: 280, width: 800, height: 40, type: 'static' }
],
hazards: []
};