-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.js
More file actions
454 lines (451 loc) · 15.5 KB
/
Copy pathdata.js
File metadata and controls
454 lines (451 loc) · 15.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
// Particle types
const ELEMENT_TYPES = {
HYDROGEN: { symbol: 'H', color: '#0FF', size: 2, mass: 1.0, electrons: 1 },
CARBON: { symbol: 'C', color: '#FFF', size: 3, mass: 12.0, electrons: 4 },
OXYGEN: { symbol: 'O', color: '#F06', size: 3, mass: 16.0, electrons: 6 },
NITROGEN: { symbol: 'N', color: '#0F6', size: 3, mass: 14.0, electrons: 5 }
};
// Achievement system
const ACHIEVEMENTS = {
first_molecule: {
id: 'first_molecule',
icon: '⚛️',
title: 'First Molecule',
description: 'Form your first stable molecule',
xp: 50,
unlocked: false,
check: () => molecules.length >= 1
},
hydrogen_factory: {
id: 'hydrogen_factory',
icon: '💨',
title: 'Hydrogen Factory',
description: 'Create 5 H₂ molecules',
xp: 100,
unlocked: false,
check: () => (moleculeTypes.get('H₂ (Hydrogen)') || 0) >= 5,
progress: () => Math.min(100, ((moleculeTypes.get('H₂ (Hydrogen)') || 0) / 5) * 100)
},
water_of_life: {
id: 'water_of_life',
icon: '💧',
title: 'Water of Life',
description: 'Successfully create H₂O (water)',
xp: 150,
unlocked: false,
check: () => moleculeTypes.has('H₂O (Water)')
},
radical_creator: {
id: 'radical_creator',
icon: '⚡',
title: 'Radical Creator',
description: 'Form an OH hydroxyl radical',
xp: 100,
unlocked: false,
check: () => moleculeTypes.has('OH (Hydroxyl)')
},
toxic_chemist: {
id: 'toxic_chemist',
icon: '☠️',
title: 'Toxic Chemist',
description: 'Create CN cyanide',
xp: 125,
unlocked: false,
check: () => moleculeTypes.has('CN (Cyanide)')
},
ammonia_maker: {
id: 'ammonia_maker',
icon: '🧪',
title: 'Ammonia Maker',
description: 'Synthesize NH₃ (ammonia)',
xp: 150,
unlocked: false,
check: () => moleculeTypes.has('NH₃ (Ammonia)')
},
molecular_diversity: {
id: 'molecular_diversity',
icon: '🌈',
title: 'Molecular Diversity',
description: 'Create 5 different molecule types',
xp: 250,
unlocked: false,
check: () => moleculeTypes.size >= 5,
progress: () => Math.min(100, (moleculeTypes.size / 5) * 100)
},
speed_demon: {
id: 'speed_demon',
icon: '🔥',
title: 'Speed Demon',
description: 'Reach 50,000 collisions',
xp: 100,
unlocked: false,
check: () => collisionCount >= 50000,
progress: () => Math.min(100, (collisionCount / 50000) * 100)
},
molecular_factory: {
id: 'molecular_factory',
icon: '🏭',
title: 'Molecular Factory',
description: 'Form 20 molecules total',
xp: 200,
unlocked: false,
check: () => molecules.length >= 20,
progress: () => Math.min(100, (molecules.length / 20) * 100)
},
thermodynamist: {
id: 'thermodynamist',
icon: '🌡️',
title: 'Thermodynamist',
description: 'Find the perfect temperature (45-55) and hold for 30s',
xp: 100,
unlocked: false,
check: () => thermoTimeInRange >= 30000, // 30 seconds in ms
progress: () => {
const progress = Math.min(100, (thermoTimeInRange / 30000) * 100);
return progress;
}
},
patient_chemist: {
id: 'patient_chemist',
icon: '⏱️',
title: 'Patient Chemist',
description: 'Run simulation for 5 minutes',
xp: 75,
unlocked: false,
check: () => getElapsedTime() >= 300000,
progress: () => Math.min(100, (getElapsedTime() / 300000) * 100)
},
carbon_dioxide: {
id: 'carbon_dioxide',
icon: '🫧',
title: 'Carbon Dioxide',
description: 'Create CO₂',
xp: 125,
unlocked: false,
check: () => moleculeTypes.has('CO₂ (Carbon Dioxide)')
},
nitrogen_gas: {
id: 'nitrogen_gas',
icon: '💨',
title: 'Nitrogen Gas',
description: 'Form N₂',
xp: 100,
unlocked: false,
check: () => moleculeTypes.has('N₂ (Nitrogen)')
},
abiogenesis: {
id: 'abiogenesis',
icon: '🌱',
title: 'Abiogenesis',
description: 'Witness the emergence of the first proto-cell',
xp: 500,
unlocked: false,
check: () => abiogenesisTriggered
},
prebiotic_soup: {
id: 'prebiotic_soup',
icon: '🧬',
title: 'Prebiotic Soup',
description: 'Create H₂O, NH₃, and HCN (building blocks of life)',
xp: 300,
unlocked: false,
check: () => moleculeTypes.has('H₂O (Water)') &&
moleculeTypes.has('NH₃ (Ammonia)') &&
moleculeTypes.has('HCN')
},
master_chemist: {
id: 'master_chemist',
icon: '👨🔬',
title: 'Master Chemist',
description: 'Unlock all other achievements',
xp: 500,
unlocked: false,
check: () => {
const others = Object.keys(ACHIEVEMENTS).filter(id => id !== 'master_chemist');
return others.every(id => ACHIEVEMENTS[id].unlocked);
}
}
};
// Achievement help data
const ACHIEVEMENT_HELP = {
first_molecule: {
description: "Form your first stable molecule from colliding particles.",
strategy: [
"Start with moderate temperature (45-55°K)",
"Keep energy input around 20-30 for stable conditions",
"Higher density increases collision chances",
"Be patient - first molecule usually forms within 30 seconds"
],
parameters: {
temperature: "45-55°K",
density: "150-250",
energy: "20-30"
},
formula: "Any two-element combination"
},
hydrogen_factory: {
description: "Create 5 H₂ (hydrogen) molecules - the most abundant molecule in the universe.",
strategy: [
"Focus on hydrogen-hydrogen collisions",
"Moderate temperatures work best (40-60°K)",
"Higher hydrogen concentration helps",
"H₂ forms easily under most conditions"
],
parameters: {
temperature: "40-60°K",
density: "200+",
energy: "15-35"
},
formula: "H + H → H₂"
},
water_of_life: {
description: "Successfully create H₂O (water) - the essential molecule for life.",
strategy: [
"Need both hydrogen and oxygen particles",
"Optimal temperature: 50-65°K",
"Balance element ratios (2:1 H:O ideal)",
"Watch for H + O → OH first, then OH + H → H₂O"
],
parameters: {
temperature: "50-65°K",
density: "200-300",
energy: "25-40"
},
formula: "2H + O → H₂O"
},
radical_creator: {
description: "Form an OH hydroxyl radical - a highly reactive molecule important in chemistry.",
strategy: [
"Hydrogen and oxygen collisions",
"Slightly higher temperatures help (55-70°K)",
"Moderate energy input (25-45)",
"OH often forms before H₂O"
],
parameters: {
temperature: "55-70°K",
density: "150-250",
energy: "25-45"
},
formula: "H + O → OH"
},
toxic_chemist: {
description: "Create CN cyanide - a simple but toxic organic molecule.",
strategy: [
"Carbon and nitrogen collisions required",
"Moderate temperatures (45-65°K)",
"Both elements needed in simulation",
"Can be rare depending on element distribution"
],
hint: "Creating Cyanide (CN) is a step towards Hydrogen Cyanide (HCN), a key component for prebiotic soup.",
parameters: {
temperature: "45-65°K",
density: "200-300",
energy: "20-40"
},
formula: "C + N → CN"
},
ammonia_maker: {
description: "Synthesize NH₃ (ammonia) - important for fertilizers and prebiotic chemistry.",
strategy: [
"Requires nitrogen and hydrogen",
"Optimal ratio: 1N:3H",
"Moderate temperatures (50-70°K)",
"Forms through intermediate steps (NH → NH₂ → NH₃)"
],
parameters: {
temperature: "50-70°K",
density: "250-350",
energy: "30-50"
},
formula: "N + 3H → NH₃"
},
molecular_diversity: {
description: "Create 5 different molecule types - demonstrating chemical variety.",
strategy: [
"Ensure all element types are present",
"Experiment with different temperatures",
"Higher density increases variety chances",
"Track progress in Molecules panel"
],
parameters: {
temperature: "Vary 40-70°K",
density: "250+",
energy: "25-45"
},
formula: "Multiple combinations"
},
speed_demon: {
description: "Reach 50,000 particle collisions - mastering high-energy conditions.",
strategy: [
"High density increases collision rate",
"Higher temperatures increase particle speed",
"More energy input creates more activity",
"Be patient - this takes time to accumulate"
],
parameters: {
temperature: "60-80°K",
density: "300+",
energy: "40-60"
},
formula: "Accumulated collisions"
},
molecular_factory: {
description: "Form 20 molecules total - becoming a proficient molecular architect.",
strategy: [
"Stable conditions help accumulation",
"Moderate parameters work best",
"Avoid extreme temperatures that break bonds",
"Higher density speeds up production"
],
parameters: {
temperature: "45-65°K",
density: "200-300",
energy: "20-40"
},
formula: "Cumulative production"
},
thermodynamist: {
description: "Find the perfect temperature (45-55°K) and maintain it for 30 seconds.",
strategy: [
"Use temperature slider carefully",
"Watch for optimal bonding conditions",
"Avoid sudden changes",
"Monitor molecule formation rate"
],
parameters: {
temperature: "45-55°K",
density: "Any",
energy: "Any"
},
formula: "Temperature stability"
},
patient_chemist: {
description: "Run simulation for 5 minutes - good science takes time!",
strategy: [
"Let the simulation run continuously",
"Observe long-term patterns",
"Make gradual parameter adjustments",
"Watch the evolution of molecular complexity"
],
parameters: {
temperature: "Any",
density: "Any",
energy: "Any"
},
formula: "Time accumulation"
},
carbon_dioxide: {
description: "Create CO₂ - essential for plant life and a key greenhouse gas.",
strategy: [
"Carbon and oxygen collisions",
"Higher temperatures help (60-75°K)",
"Often forms via CO intermediate",
"Watch for C + O₂ → CO₂ or C + 2O → CO₂"
],
parameters: {
temperature: "60-75°K",
density: "200-300",
energy: "30-50"
},
formula: "C + O₂ → CO₂ or C + 2O → CO₂"
},
nitrogen_gas: {
description: "Form N₂ - making up 78% of Earth's atmosphere.",
strategy: [
"Nitrogen-nitrogen collisions",
"Moderate conditions work well",
"Very stable once formed",
"Common in nitrogen-rich environments"
],
parameters: {
temperature: "40-65°K",
density: "200-300",
energy: "20-40"
},
formula: "N + N → N₂"
},
prebiotic_soup: {
description: "Create H₂O, NH₃, and HCN - the building blocks of life.",
strategy: [
"Most challenging achievement!",
"Need all element types present",
"Balance parameters carefully",
"Try creating H₂O and NH₃ first in the 50-70°K range.",
"HCN (Hydrogen Cyanide) often requires slightly higher energy. Try creating CN (Cyanide) first, then see if it bonds with Hydrogen.",
"Focus on one molecule at a time"
],
parameters: {
temperature: "50-70°K",
density: "250-350",
energy: "30-50"
},
formula: "H₂O + NH₃ + HCN"
},
master_chemist: {
description: "Unlock all other achievements - becoming a true molecular master.",
strategy: [
"Systematically work through each achievement",
"Use the help information for each one",
"Track your progress in this panel",
"Experiment and learn from each simulation",
"Patience and observation are key"
],
parameters: {
temperature: "All ranges",
density: "All ranges",
energy: "All ranges"
},
formula: "Complete all challenges"
}
};
const LEVEL_DEFINITIONS = [
{ // Level 0
name: "Particle Soup",
goal: "Form your first molecule.",
xp_reward: 100,
unlocks: "Oxygen particles become available.",
checkCompletion: () => molecules.length >= 1,
getProgress: () => {
if (molecules.length > 0) return 100;
return Math.min(99, (collisionCount / 1000) * 100);
}
},
{ // Level 1
name: "Molecular Weaver",
goal: "Create H₂O (Water).",
xp_reward: 150,
unlocks: "Carbon and Nitrogen particles become available.",
checkCompletion: () => moleculeTypes.has('H₂O (Water)'),
getProgress: () => {
const totalMoleculesNeeded = 10;
const waterProgress = moleculeTypes.has('H₂O (Water)') ? 50 : 0;
const moleculeCountProgress = Math.min(50, (molecules.length / totalMoleculesNeeded) * 50);
return waterProgress + moleculeCountProgress;
}
},
{ // Level 2
name: "Prebiotic Soup",
goal: "Create the building blocks of life: H₂O, NH₃, and HCN.",
xp_reward: 300,
unlocks: "Higher bonding complexity.",
checkCompletion: () => moleculeTypes.has('H₂O (Water)') && moleculeTypes.has('NH₃ (Ammonia)') && moleculeTypes.has('HCN'),
getProgress: () => {
let progress = 0;
if (moleculeTypes.has('H₂O (Water)')) progress += 33;
if (moleculeTypes.has('NH₃ (Ammonia)')) progress += 33;
if (moleculeTypes.has('HCN')) progress += 33;
return progress;
}
},
{ // Level 3
name: "Life Seeder",
goal: "Witness the miracle of abiogenesis.",
xp_reward: 1000,
unlocks: "LifeForge and the next era of evolution!",
checkCompletion: () => abiogenesisTriggered,
getProgress: () => {
let progress = (moleculeTypes.get('Glycine (Amino Acid)') ? 50 : 0) + (moleculeTypes.get('Lipid Precursor') ? 50 : 0);
return progress;
}
}
];