Files
synthesis/.cursor/rules/chemistry-engine.mdc
Денис Шкабатур 10bd67c951 Phase 0: Project setup for agent-driven development
- Phaser 3 + bitECS 0.4 + TypeScript + Vite stack
- BootScene with title screen
- 6 cursor rules (project context, agent workflow, ECS, chemistry, Phaser, data)
- Vitest configured with happy-dom
- GDD, engine analysis, implementation plan, progress tracking

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 11:59:41 +03:00

41 lines
1.2 KiB
Plaintext

---
description: Chemistry engine — real science constraints and data patterns
globs: src/chemistry/**/*.ts
alwaysApply: false
---
# Chemistry Engine Rules
## Scientific Accuracy
All chemical data must be **real** (simplified, never fabricated):
- Element properties: atomic number, mass, electronegativity, group, period
- Reactions: real products, real conditions (temperature, catalyst)
- Failed reactions return a **reason**: "Requires catalyst", "Insufficient energy"
## Element Interface
```typescript
interface Element {
symbol: string; // "Na"
name: string; // "Sodium"
atomicNumber: number; // 11
atomicMass: number; // 22.99
electronegativity: number;
category: ElementCategory;
state: MatterState; // at room temperature
color: string; // hex for rendering
}
```
## Reaction Lookup
Reactions indexed by **sorted reactant key** for O(1) lookup:
```typescript
// "Cl+Na" → { products: [{ symbol: "NaCl", ... }], ... }
function reactionKey(symbols: string[]): string {
return [...symbols].sort().join('+');
}
```
## Every Reaction Includes
- `description`: human-readable explanation of the science
- `failureReason`: if conditions not met, explain WHY (this is the teaching mechanism)