Generation Prompt
Page: Creatures - Genetic Algorithm Simulation
Slogan: "Watch virtual organisms evolve through natural selection"
Structure:
- Widget before:title → h1 + p.slogan centered
- Main → Canvas in .card.full.ratio-16-9 (HD via devicePixelRatio)
- Widget right:stats → Statistics (generation, population, food)
- Widget right:rules → Rules checkboxes with descriptions
- Widget after:legend → Color legend (speed=red, size=blue, perception=green)
- Widget after:algorithm → Algorithm explanation
- Widget modal:claude → Documentation
Rules (toggleable):
- Predation: Large eat small (+50% energy)
- Aging: Slow down, die at max age
- Obstacles: Gray zones block movement
- Territories: Green zones spawn more food
- Varied food: Small/medium/large (25/50/75)
- Sexual: Two parents, gene crossover
- Fatigue: High speed costs extra energy
- Flee: Small flee from predators
Creature genes (0-1): speed, size, senseRange, aggression
Derived traits: speed 1-4, size 5-15, senseRange 20-100
Energy: starts 100, decays based on genes, reproduce at 150
Genetic loop:
1. Update creatures (move toward food, flee predators)
2. Eat food (gain energy based on size)
3. Reproduce if energy > threshold
4. Apply mutations (rate 0.2, strength 0.15)
5. Remove dead (energy <= 0 or age >= MAX_AGE)
6. Repopulate if extinction