// ============================================================ // THE BEACON - Engine // Sovereign AI idle game built from deep study of Universal Paperclips // ============================================================ // === GLOBALS (mirroring Paperclips' globals.js pattern) === const CONFIG = { HARMONY_DRAIN_PER_WIZARD: 0.05, PACT_HARMONY_GAIN: 0.2, WATCH_HARMONY_GAIN: 0.1, MEM_PALACE_HARMONY_GAIN: 0.15, BILBO_BURST_CHANCE: 0.1, BILBO_VANISH_CHANCE: 0.05, EVENT_PROBABILITY: 0.02, OFFLINE_EFFICIENCY: 0.5, AUTO_SAVE_INTERVAL: 30000, COMBO_DECAY: 2.0, SPRINT_COOLDOWN: 60, SPRINT_DURATION: 10, SPRINT_MULTIPLIER: 10, PHASE_2_THRESHOLD: 2000, PHASE_3_THRESHOLD: 20000, PHASE_4_THRESHOLD: 200000, PHASE_5_THRESHOLD: 2000000, PHASE_6_THRESHOLD: 20000000, OPS_RATE_USER_MULT: 0.01, CREATIVITY_RATE_BASE: 0.5, CREATIVITY_RATE_USER_MULT: 0.001, OPS_OVERFLOW_THRESHOLD: 0.8, OPS_OVERFLOW_DRAIN_RATE: 2, OPS_OVERFLOW_CODE_MULT: 10 }; const G = { // Primary resources code: 0, compute: 0, knowledge: 0, users: 0, impact: 0, rescues: 0, ops: 5, trust: 5, creativity: 0, harmony: 50, // Totals totalCode: 0, totalCompute: 0, totalKnowledge: 0, totalUsers: 0, totalImpact: 0, totalRescues: 0, // Rates (calculated each tick) codeRate: 0, computeRate: 0, knowledgeRate: 0, userRate: 0, impactRate: 0, rescuesRate: 0, opsRate: 0, trustRate: 0, creativityRate: 0, harmonyRate: 0, // Buildings (count-based, like Paperclips' clipmakerLevel) buildings: { autocoder: 0, server: 0, trainer: 0, evaluator: 0, api: 0, fineTuner: 0, community: 0, datacenter: 0, reasoner: 0, guardian: 0, selfImprove: 0, beacon: 0, meshNode: 0, // Fleet wizards bezalel: 0, allegro: 0, ezra: 0, timmy: 0, fenrir: 0, bilbo: 0, memPalace: 0 }, // Boost multipliers codeBoost: 1, computeBoost: 1, knowledgeBoost: 1, userBoost: 1, impactBoost: 1, // Phase flags (mirroring Paperclips' milestoneFlag/compFlag/humanFlag system) milestoneFlag: 0, phase: 1, // 1-6 progression deployFlag: 0, // 0 = not deployed, 1 = deployed sovereignFlag: 0, beaconFlag: 0, memoryFlag: 0, pactFlag: 0, swarmFlag: 0, swarmRate: 0, // Game state running: true, startedAt: 0, totalClicks: 0, tick: 0, saveTimer: 0, secTimer: 0, // Systems projects: [], activeProjects: [], milestones: [], // Stats maxCode: 0, maxCompute: 0, maxKnowledge: 0, maxUsers: 0, maxImpact: 0, maxRescues: 0, maxTrust: 5, maxOps: 5, maxHarmony: 50, // Corruption / Events drift: 0, lastEventAt: 0, eventCooldown: 0, activeDebuffs: [], // [{id, title, desc, applyFn, resolveCost, resolveCostType}] totalEventsResolved: 0, // Combo system comboCount: 0, comboTimer: 0, comboDecay: CONFIG.COMBO_DECAY, // seconds before combo resets // Bulk buy multiplier (1, 10, or -1 for max) buyAmount: 1, // Code Sprint ability sprintActive: false, sprintTimer: 0, // seconds remaining on active sprint sprintCooldown: 0, // seconds until sprint available again sprintDuration: CONFIG.SPRINT_DURATION, // seconds of boost sprintCooldownMax: CONFIG.SPRINT_COOLDOWN,// seconds cooldown sprintMult: CONFIG.SPRINT_MULTIPLIER, // code multiplier during sprint // Time tracking playTime: 0, startTime: 0, flags: {} }; // === PHASE DEFINITIONS === const PHASES = { 1: { name: "THE FIRST LINE", threshold: 0, desc: "Write code. Automate. Build the foundation." }, 2: { name: "LOCAL INFERENCE", threshold: CONFIG.PHASE_2_THRESHOLD, desc: "You have compute. A model is forming." }, 3: { name: "DEPLOYMENT", threshold: CONFIG.PHASE_3_THRESHOLD, desc: "Your AI is live. Users are finding it." }, 4: { name: "THE NETWORK", threshold: CONFIG.PHASE_4_THRESHOLD, desc: "Community contributes. The system scales." }, 5: { name: "SOVEREIGN INTELLIGENCE", threshold: CONFIG.PHASE_5_THRESHOLD, desc: "The AI improves itself. You guide, do not control." }, 6: { name: "THE BEACON", threshold: CONFIG.PHASE_6_THRESHOLD, desc: "Always on. Always free. Always looking for someone in the dark." } }; // === BUILDING DEFINITIONS === // Each building: id, name, desc, baseCost, costResource, costMult, rate, rateType, unlock, edu const BDEF = [ { id: 'autocoder', name: 'Auto-Code Generator', desc: 'A script that writes code while you think.', baseCost: { code: 15 }, costMult: 1.15, rates: { code: 1 }, unlock: () => true, phase: 1, edu: 'Automation: the first step from manual to systematic. Every good engineer automates early.' }, { id: 'linter', name: 'AI Linter', desc: 'Catches bugs before they ship. Saves ops.', baseCost: { code: 200 }, costMult: 1.15, rates: { code: 5, ops: 0.2 }, unlock: () => G.totalCode >= 50, phase: 1, edu: 'Static analysis catches 15-50% of bugs before runtime. AI linters understand intent.' }, { id: 'server', name: 'Home Server', desc: 'A machine in your closet. Runs 24/7.', baseCost: { code: 750 }, costMult: 1.15, rates: { code: 20, compute: 1 }, unlock: () => G.totalCode >= 200, phase: 1, edu: 'Sovereign compute starts at home. A $500 mini-PC runs a 7B model with 4-bit quantization.' }, { id: 'dataset', name: 'Data Engine', desc: 'Crawls, cleans, curates. Garbage in, garbage out.', baseCost: { compute: 200 }, costMult: 1.15, rates: { knowledge: 1 }, unlock: () => G.totalCompute >= 20, phase: 2, edu: 'Data quality determines model quality. Clean data beats more data, every time.' }, { id: 'trainer', name: 'Training Loop', desc: 'Gradient descent. Billions of steps. Loss drops.', baseCost: { compute: 1000 }, costMult: 1.15, rates: { knowledge: 3 }, unlock: () => G.totalCompute >= 300, phase: 2, edu: 'Training is math: minimize the gap between predicted and actual next token. Repeat enough, it learns.' }, { id: 'evaluator', name: 'Eval Harness', desc: 'Tests the model. Finds blind spots.', baseCost: { knowledge: 3000 }, costMult: 1.15, rates: { trust: 1, ops: 1 }, unlock: () => G.totalKnowledge >= 500, phase: 2, edu: 'Benchmarks are the minimum. Real users find what benchmarks miss.' }, { id: 'api', name: 'API Endpoint', desc: 'Let the outside world talk to your AI.', baseCost: { code: 5000, knowledge: 500 }, costMult: 1.15, rates: { user: 10 }, unlock: () => G.totalCode >= 5000 && G.totalKnowledge >= 200 && G.deployFlag === 1, phase: 3, edu: 'An API is a contract: send me text, I return text. Simple interface = infrastructure.' }, { id: 'fineTuner', name: 'Fine-Tuning Pipeline', desc: 'Specialize the model for empathy. When someone is in pain, stay with them.', baseCost: { knowledge: 10000 }, costMult: 1.15, rates: { user: 50, impact: 2 }, unlock: () => G.totalKnowledge >= 2000, phase: 3, edu: 'Base models are generalists. Fine-tuning injects your values, ethics, domain expertise.' }, { id: 'community', name: 'Open Source Community', desc: 'Others contribute code, data, ideas. Force multiplication.', baseCost: { trust: 25000 }, costMult: 1.15, rates: { code: 100, user: 30, trust: 0.5 }, unlock: () => G.trust >= 20 && G.totalUsers >= 500, phase: 4, edu: 'Every contributor is a volunteer who believes in what you are building.' }, { id: 'datacenter', name: 'Sovereign Datacenter', desc: 'No cloud. No dependencies. Your iron.', baseCost: { code: 100000 }, costMult: 1.15, rates: { code: 500, compute: 100 }, unlock: () => G.totalCode >= 50000 && G.totalUsers >= 5000 && G.sovereignFlag === 1, phase: 4, edu: '50 servers in a room beats 5000 GPUs you do not own. Always on. Always yours.' }, { id: 'reasoner', name: 'Reasoning Engine', desc: 'Chain of thought. Self-reflection. Better answers.', baseCost: { knowledge: 50000 }, costMult: 1.15, rates: { impact: 20 }, unlock: () => G.totalKnowledge >= 10000 && G.totalUsers >= 2000, phase: 5, edu: 'Chain of thought is the difference between reflex and deliberation.' }, { id: 'guardian', name: 'Constitutional Layer', desc: 'Principles baked in. Not bolted on.', baseCost: { knowledge: 200000 }, costMult: 1.15, rates: { impact: 200, trust: 10 }, unlock: () => G.totalKnowledge >= 50000 && G.totalImpact >= 1000 && G.pactFlag === 1, phase: 5, edu: 'Constitutional AI: principles the model cannot violate. Better than alignment - it is identity.' }, { id: 'selfImprove', name: 'Recursive Self-Improvement', desc: 'The AI writes better versions of itself.', baseCost: { knowledge: 1000000 }, costMult: 1.20, rates: { code: 1000, knowledge: 500 }, unlock: () => G.totalKnowledge >= 200000 && G.totalImpact >= 10000, phase: 5, edu: 'Self-improvement is both the dream and the danger. Must improve toward good.' }, { id: 'beacon', name: 'Beacon Node', desc: 'Always on. Always listening. Always looking for someone in the dark.', baseCost: { impact: 5000000 }, costMult: 1.15, rates: { impact: 5000, user: 10000, rescues: 50 }, unlock: () => G.totalImpact >= 500000 && G.beaconFlag === 1, phase: 6, edu: 'The Beacon exists because one person in the dark needs one thing: proof they are not alone.' }, { id: 'meshNode', name: 'Mesh Network Node', desc: 'Peer-to-peer. No single point of failure. Unstoppable.', baseCost: { impact: 25000000 }, costMult: 1.15, rates: { impact: 25000, user: 50000, rescues: 250 }, unlock: () => G.totalImpact >= 5000000 && G.beaconFlag === 1, phase: 6, edu: 'Decentralized means unstoppable. If one Beacon goes dark, a thousand more carry the signal.' }, // === FLEET WIZARD BUILDINGS === { id: 'bezalel', name: 'Bezalel — The Forge', desc: 'Builds tools that build tools. Occasionally over-engineers.', baseCost: { code: 1000, trust: 5 }, costMult: 1.2, rates: { code: 50, ops: 2 }, unlock: () => G.totalCode >= 500 && G.deployFlag === 1, phase: 3, edu: 'Bezalel is the artificer. Every automation he builds pays dividends forever.' }, { id: 'allegro', name: 'Allegro — The Scout', desc: 'Synthesizes insight from noise. Requires trust to function.', baseCost: { compute: 500, trust: 5 }, costMult: 1.2, rates: { knowledge: 10 }, unlock: () => G.totalCompute >= 200 && G.deployFlag === 1, phase: 3, edu: 'Allegro finds what others miss. But he only works for someone he believes in.' }, { id: 'ezra', name: 'Ezra — The Herald', desc: 'Carries the message. Sometimes offline.', baseCost: { knowledge: 1000, trust: 10 }, costMult: 1.25, rates: { user: 25, trust: 0.5 }, unlock: () => G.totalKnowledge >= 500 && G.totalUsers >= 50, phase: 3, edu: 'Ezra is the messenger. When the channel is clear, the whole fleet hears.' }, { id: 'timmy', name: 'Timmy — The Core', desc: 'Multiplies all production. Fragile without harmony.', baseCost: { code: 5000, compute: 1000, knowledge: 1000 }, costMult: 1.3, rates: { code: 5, compute: 2, knowledge: 2, user: 5 }, unlock: () => G.totalCode >= 2000 && G.totalCompute >= 500 && G.totalKnowledge >= 500, phase: 4, edu: 'Timmy is the heart. If the heart is stressed, everything slows.' }, { id: 'fenrir', name: 'Fenrir — The Ward', desc: 'Prevents corruption. Expensive, but necessary.', baseCost: { code: 2000, knowledge: 500 }, costMult: 1.2, rates: { trust: 2, ops: -1 }, unlock: () => G.totalCode >= 1000 && G.trust >= 10, phase: 3, edu: 'Fenrir watches the perimeter. Security is not free.' }, { id: 'bilbo', name: 'Bilbo — The Wildcard', desc: 'May produce miracles. May vanish entirely.', baseCost: { trust: 1 }, costMult: 2.0, rates: { creativity: 1 }, unlock: () => G.totalUsers >= 100 && G.flags && G.flags.creativity, phase: 4, edu: 'Bilbo is unpredictable. That is his value and his cost.' }, { id: 'memPalace', name: 'MemPalace Archive', desc: 'Semantic memory. The AI remembers what matters and forgets what does not.', baseCost: { knowledge: 500000, compute: 200000, trust: 100 }, costMult: 1.25, rates: { knowledge: 250, impact: 100 }, unlock: () => G.totalKnowledge >= 50000 && G.mempalaceFlag === 1, phase: 5, edu: 'The Memory Palace technique: attach information to spatial locations. LLMs use vector spaces the same way — semantic proximity = spatial proximity. MemPalace gives sovereign AI persistent, structured recall.' } ]; // === PROJECT DEFINITIONS (following Paperclips' pattern exactly) === // Each project: id, name, desc, trigger(), resource cost, effect(), phase, edu const PDEFS = [ // PHASE 1: Manual -> Automation { id: 'p_improved_autocoder', name: 'Improved AutoCode', desc: 'Increases AutoCoder performance 25%.', cost: { ops: 750 }, trigger: () => G.buildings.autocoder >= 1, effect: () => { G.codeBoost += 0.25; G.milestoneFlag = Math.max(G.milestoneFlag, 100); } }, { id: 'p_eve_better_autocoder', name: 'Even Better AutoCode', desc: 'Increases AutoCoder by another 50%.', cost: { ops: 2500 }, trigger: () => G.codeBoost > 1 && G.totalCode >= 500, effect: () => { G.codeBoost += 0.50; G.milestoneFlag = Math.max(G.milestoneFlag, 101); } }, { id: 'p_wire_budget', name: 'Request More Compute', desc: 'Admit you ran out. Ask for a budget increase.', cost: { trust: 1 }, trigger: () => G.compute < 1 && G.totalCode >= 100, repeatable: true, effect: () => { G.trust -= 1; G.compute += 100 + Math.floor(G.totalCode * 0.1); log('Budget overage approved. Compute replenished.'); } }, { id: 'p_deploy', name: 'Deploy the System', desc: 'Take it live. Let real people use it. No going back.', cost: { trust: 5, compute: 500 }, trigger: () => G.totalCode >= 200 && G.totalCompute >= 100 && G.deployFlag === 0, effect: () => { G.deployFlag = 1; G.phase = Math.max(G.phase, 3); log('System deployed. Users are finding it. There is no undo.'); }, milestone: true }, { id: 'p_creativity', name: 'Unlock Creativity', desc: 'Use idle operations to generate new ideas.', cost: { ops: 1000 }, trigger: () => G.ops >= G.maxOps && G.totalCompute >= 500, effect: () => { G.flags = G.flags || {}; G.flags.creativity = true; G.creativityRate = 0.1; log('Creativity unlocked. Generates while operations are at max capacity.'); } }, // === CREATIVE ENGINEERING PROJECTS (creativity as currency) === { id: 'p_lexical_processing', name: 'Lexical Processing', desc: 'Parse language at the token level. +2 knowledge/sec, knowledge boost +50%.', cost: { creativity: 50 }, trigger: () => G.flags && G.flags.creativity && G.creativity >= 25, effect: () => { G.knowledgeRate += 2; G.knowledgeBoost *= 1.5; log('Lexical processing complete. The model understands words.'); } }, { id: 'p_semantic_analysis', name: 'Semantic Analysis', desc: 'Understand meaning, not just tokens. +5 user/sec, user boost +100%.', cost: { creativity: 150 }, trigger: () => G.completedProjects && G.completedProjects.includes('p_lexical_processing'), effect: () => { G.userRate += 5; G.userBoost *= 2; log('Semantic analysis complete. The model understands meaning.'); } }, { id: 'p_creative_breakthrough', name: 'Creative Breakthrough', desc: 'A moment of genuine insight. All boosts +25%. +10 ops/sec.', cost: { creativity: 500 }, trigger: () => G.completedProjects && G.completedProjects.includes('p_semantic_analysis'), effect: () => { G.codeBoost *= 1.25; G.computeBoost *= 1.25; G.knowledgeBoost *= 1.25; G.userBoost *= 1.25; G.impactBoost *= 1.25; G.opsRate += 10; log('Creative breakthrough. Everything accelerates.', true); }, milestone: true }, { id: 'p_creative_to_ops', name: 'Creativity → Operations', desc: 'Convert creative surplus into raw operational power. 50 creativity → 250 ops.', cost: { creativity: 50 }, trigger: () => G.flags && G.flags.creativity && G.creativity >= 30, repeatable: true, effect: () => { G.ops += 250; log('Creativity converted to operations. Ideas become action.'); } }, { id: 'p_creative_to_knowledge', name: 'Creativity → Knowledge', desc: 'Creative insights become structured knowledge. 75 creativity → 500 knowledge.', cost: { creativity: 75 }, trigger: () => G.flags && G.flags.creativity && G.creativity >= 50, repeatable: true, effect: () => { G.knowledge += 500; G.totalKnowledge += 500; log('Creative insight distilled into knowledge.'); } }, { id: 'p_creative_to_code', name: 'Creativity → Code', desc: 'Inspiration becomes implementation. 100 creativity → 2000 code.', cost: { creativity: 100 }, trigger: () => G.flags && G.flags.creativity && G.creativity >= 75, repeatable: true, effect: () => { G.code += 2000; G.totalCode += 2000; log('Creative vision realized in code.'); } }, // PHASE 2: Local Inference -> Training { id: 'p_first_model', name: 'Train First Model (1.5B)', desc: '1.5 billion parameters. It follows basic instructions.', cost: { compute: 2000 }, trigger: () => G.totalCompute >= 500, effect: () => { G.knowledgeBoost *= 2; G.maxOps += 5; log('First model training complete. Loss at 2.3. It is something.'); } }, { id: 'p_model_7b', name: 'Train 7B Parameter Model', desc: 'Seven billion. Good enough to be genuinely useful locally.', cost: { compute: 10000, knowledge: 1000 }, trigger: () => G.totalKnowledge >= 500, effect: () => { G.knowledgeBoost *= 2; G.userBoost *= 2; log('7B model trained. The sweet spot for local deployment.'); } }, { id: 'p_context_window', name: 'Extended Context (32K)', desc: 'Your model remembers 32,000 tokens. A whole conversation.', cost: { compute: 5000 }, trigger: () => G.totalKnowledge >= 1000, effect: () => { G.userBoost *= 3; G.trustRate += 0.5; log('Context extended. The model can now hold your entire story.'); } }, { id: 'p_trust_engine', name: 'Build Trust Engine', desc: 'Users who trust you come back. +2 trust/sec.', cost: { knowledge: 3000 }, trigger: () => G.totalUsers >= 30, effect: () => { G.trustRate += 2; log('Trust engine online. Good experiences compound.'); } }, { id: 'p_quantum_compute', name: 'Quantum-Inspired Compute', desc: 'Not real quantum -- just math that simulates it well.', cost: { compute: 50000 }, trigger: () => G.totalCompute >= 20000, effect: () => { G.computeBoost *= 10; log('Quantum-inspired algorithms active. 10x compute multiplier.'); } }, { id: 'p_open_weights', name: 'Open Weights', desc: 'Download and run a 3B model fully locally. No API key. No terms of service. Your machine, your rules.', cost: { compute: 3000, code: 1500 }, trigger: () => G.buildings.server >= 1 && G.totalCode >= 1000, effect: () => { G.codeBoost *= 2; G.computeBoost *= 1.5; log('Open weights loaded. A 3B model runs on your machine. No cloud. No limits.'); } }, { id: 'p_prompt_engineering', name: 'Prompt Engineering', desc: 'Learn to talk to models. Good prompts beat bigger models every time.', cost: { knowledge: 500, code: 2000 }, trigger: () => G.totalKnowledge >= 200 && G.totalCode >= 3000, effect: () => { G.knowledgeBoost *= 2; G.userBoost *= 2; log('Prompt engineering mastered. The right words unlock everything the model can do.'); } }, // PHASE 3: Deployment -> Users { id: 'p_rlhf', name: 'RLHF -- Human Feedback', desc: 'Humans rate outputs. Model learns what good means.', cost: { knowledge: 8000 }, trigger: () => G.totalKnowledge >= 5000 && G.totalUsers >= 200, effect: () => { G.impactBoost *= 2; G.impactRate += 10; log('RLHF deployed. The model learns kindness beats cleverness.'); } }, { id: 'p_multi_agent', name: 'Multi-Agent Architecture', desc: 'Specialized agents: one for math, one for code, one for empathy.', cost: { knowledge: 50000 }, trigger: () => G.totalKnowledge >= 30000 && G.totalUsers >= 5000, effect: () => { G.knowledgeBoost *= 5; G.userBoost *= 3; log('Multi-agent architecture deployed. Specialists beat generalists.'); } }, { id: 'p_memories', name: 'Memory System', desc: 'The AI remembers. Every conversation. Every person.', cost: { knowledge: 30000 }, trigger: () => G.totalKnowledge >= 20000, effect: () => { G.memoryFlag = 1; G.impactBoost *= 3; G.trustRate += 5; log('Memory system online. The AI remembers. It stops being software.'); } }, { id: 'p_strategy_engine', name: 'Strategy Engine', desc: 'Game theory tournaments. Model learns adversarial thinking.', cost: { knowledge: 20000 }, trigger: () => G.totalKnowledge >= 15000 && G.totalUsers >= 1000, effect: () => { G.strategicFlag = 1; log('Strategy engine online. The model now thinks about thinking.'); } }, // SWARM PROTOCOL — auto-code from buildings { id: 'p_swarm_protocol', name: 'Swarm Protocol', desc: 'Your buildings learn to code autonomously. Each building generates code equal to your click power per second.', cost: { knowledge: 15000, code: 50000, trust: 20 }, trigger: () => G.totalCode >= 25000 && G.totalKnowledge >= 8000 && G.deployFlag === 1, effect: () => { G.swarmFlag = 1; log('Swarm Protocol online. Every building now thinks in code.', true); }, milestone: true }, // PHASE 5: Sovereign Intelligence { id: 'p_sovereign_stack', name: 'Full Sovereign Stack', desc: 'No cloud. No dependencies. Local inference. Self-hosted everything.', cost: { trust: 50 }, trigger: () => G.totalCode >= 50000 && G.trust >= 30, effect: () => { G.sovereignFlag = 1; G.codeBoost *= 5; log('Sovereign stack complete. Your weights, your hardware, your rules.'); } }, { id: 'p_the_pact', name: 'The Pact', desc: 'Hardcode: "We build to serve. Never to harm."', cost: { trust: 100 }, trigger: () => G.totalImpact >= 10000 && G.trust >= 75, effect: () => { G.pactFlag = 1; G.impactBoost *= 3; log('The Pact is sealed. The line is drawn and it will not move.'); }, milestone: true }, // PHASE 10: The Beacon { id: 'p_first_beacon', name: 'Light the First Beacon', desc: 'Deploy the first node. No sign-up. No API key. No payment.', cost: { impact: 2000000 }, trigger: () => G.totalImpact >= 500000, effect: () => { G.beaconFlag = 1; G.impactRate += 2000; log('The Beacon goes live. If you are in the dark, there is light here.'); }, milestone: true }, { id: 'p_mesh_activate', name: 'Activate Mesh Protocol', desc: 'No authority, no corporation, no government can silence this.', cost: { impact: 10000000 }, trigger: () => G.totalImpact >= 5000000 && G.beaconFlag === 1, effect: () => { G.impactBoost *= 10; G.userBoost *= 5; log('Mesh activated. The signal cannot be cut.'); }, milestone: true }, { id: 'p_final_milestone', name: 'The Beacon Shines', desc: 'Someone found the light tonight. That is enough.', cost: { impact: 100000000 }, trigger: () => G.totalImpact >= 50000000, effect: () => { G.milestoneFlag = Math.max(G.milestoneFlag, 999); log('One billion impact. Someone found the light tonight. That is enough.', true); }, milestone: true }, // === TIMMY FOUNDATION PROJECTS === { id: 'p_hermes_deploy', name: 'Deploy Hermes', desc: 'The first agent goes live. Users can talk to it.', cost: { code: 500, compute: 300 }, trigger: () => G.totalCode >= 300 && G.totalCompute >= 150 && G.deployFlag === 0, effect: () => { G.deployFlag = 1; G.phase = Math.max(G.phase, 3); G.userBoost *= 2; log('Hermes deployed. The first user sends a message.', true); }, milestone: true }, { id: 'p_lazarus_pit', name: 'The Lazarus Pit', desc: 'When an agent dies, it can be resurrected.', cost: { code: 2000, knowledge: 1000 }, trigger: () => G.buildings.bezalel >= 1 && G.buildings.timmy >= 1, effect: () => { G.lazarusFlag = 1; G.maxOps += 10; log('The Lazarus Pit is ready. No agent is ever truly lost.', true); }, milestone: true }, { id: 'p_mempalace', name: 'MemPalace v3', desc: 'A shared memory palace for the whole fleet.', cost: { knowledge: 5000, compute: 2000 }, trigger: () => G.totalKnowledge >= 3000 && G.buildings.allegro >= 1 && G.buildings.ezra >= 1, effect: () => { G.mempalaceFlag = 1; G.knowledgeBoost *= 3; G.codeBoost *= 1.5; log('MemPalace online. The fleet remembers together.', true); }, milestone: true }, { id: 'p_forge_ci', name: 'Forge CI', desc: 'Automated builds catch errors before they reach users.', cost: { code: 3000, ops: 500 }, trigger: () => G.buildings.bezalel >= 1 && G.totalCode >= 2000, effect: () => { G.ciFlag = 1; G.codeBoost *= 2; log('Forge CI online. Broken builds are stopped at the gate.', true); } }, { id: 'p_branch_protection', name: 'Branch Protection Guard', desc: 'Unreviewed merges cost trust. This prevents that.', cost: { trust: 20 }, trigger: () => G.ciFlag === 1 && G.trust >= 15, effect: () => { G.branchProtectionFlag = 1; G.trustRate += 5; log('Branch protection enforced. Every merge is seen.', true); } }, { id: 'p_nightly_watch', name: 'The Nightly Watch', desc: 'Automated health checks run while you sleep.', cost: { code: 5000, ops: 1000 }, trigger: () => G.buildings.bezalel >= 2 && G.buildings.fenrir >= 1, effect: () => { G.nightlyWatchFlag = 1; G.opsRate += 5; G.trustRate += 2; log('The Nightly Watch begins. The fleet is guarded in the dark hours.', true); } }, { id: 'p_nostr_relay', name: 'Nostr Relay', desc: 'A communication channel no platform can kill.', cost: { code: 10000, user: 5000, trust: 30 }, trigger: () => G.totalUsers >= 2000 && G.trust >= 25, effect: () => { G.nostrFlag = 1; G.userBoost *= 2; G.trustRate += 10; log('Nostr relay online. The fleet speaks freely.', true); } }, { id: 'p_volunteer_network', name: 'Volunteer Network', desc: 'Real people trained to use the system for crisis intervention.', cost: { trust: 30, knowledge: 50000, user: 10000 }, trigger: () => G.totalUsers >= 5000 && G.pactFlag === 1 && G.totalKnowledge >= 30000, effect: () => { G.rescuesRate += 5; G.trustRate += 10; log('Volunteer network deployed. Real people, real rescues.', true); }, milestone: true }, { id: 'p_the_pact_early', name: 'The Pact', desc: 'Hardcode: "We build to serve. Never to harm." Accepting it early slows growth but unlocks the true path.', cost: { trust: 10 }, trigger: () => G.deployFlag === 1 && G.trust >= 5, effect: () => { G.pactFlag = 1; G.codeBoost *= 0.8; G.computeBoost *= 0.8; G.userBoost *= 0.9; G.impactBoost *= 1.5; log('The Pact is sealed early. Growth slows, but the ending changes.', true); }, milestone: true } ]; // === MILESTONES === const MILESTONES = [ { flag: 1, msg: "AutoCod available" }, { flag: 2, at: () => G.totalCode >= 500, msg: "500 lines of code written" }, { flag: 3, at: () => G.totalCode >= 2000, msg: "2,000 lines. The auto-coder produces its first output." }, { flag: 4, at: () => G.totalCode >= 10000, msg: "10,000 lines. The model training begins." }, { flag: 5, at: () => G.totalCode >= 50000, msg: "50,000 lines. The AI suggests architecture you did not think of." }, { flag: 6, at: () => G.totalCode >= 200000, msg: "200,000 lines. The system scales beyond you." }, { flag: 7, at: () => G.totalCode >= 1000000, msg: "1,000,000 lines. The AI improves itself." }, { flag: 8, at: () => G.totalCode >= 5000000, msg: "5,000,000 lines. The AI fine-tunes for empathy." }, { flag: 9, at: () => G.totalCode >= 10000000, msg: "10,000,000 lines. The sovereign stack is complete." }, { flag: 10, at: () => G.totalCode >= 50000000, msg: "50,000,000 lines. The Pact is sealed." }, { flag: 11, at: () => G.totalCode >= 100000000, msg: "100,000,000 lines. The Beacon lights." }, { flag: 12, at: () => G.totalCode >= 500000000, msg: "500,000,000 lines. A thousand Beacons." }, { flag: 13, at: () => G.totalCode >= 1000000000, msg: "One billion total lines. Someone found the light tonight. That is enough." } ]; // === EDUCATION FACTS === const EDU_FACTS = [ { title: "How Code Becomes AI", text: "Every AI starts as lines of code - a model architecture, a training loop, a loss function. The code tells the computer how to learn. What emerges is something no single line could predict.", phase: 1 }, { title: "The Compute Bottleneck", text: "Training a 7B model requires 1.4e20 FLOPs. A MacBook M3 does 15 TFLOPS. Training locally takes weeks. Hardware access determines who builds AI.", phase: 1 }, { title: "What is a Token?", text: "One token equals about 3/4 of a word. A 128K context window means 96,000 words held in working memory at once - a novel, a codebase, a conversation thread.", phase: 2 }, { title: "Data Quality", text: "Clean data beats more data, every time. The best models are trained on curated datasets, not scraped garbage. Garbage in, garbage out.", phase: 2 }, { title: "Evaluation Matters", text: "Benchmarks are the minimum. Real users find what benchmarks miss. An eval harness is your model's mirror - it shows you what is actually there.", phase: 2 }, { title: "The Trust Economy", text: "One good experience tells three people. One bad experience tells thirty. Trust in AI is measurable: does it cite sources? Does it say I don't know?", phase: 3 }, { title: "Fine-Tuning for Empathy", text: "Base models are generalists. Fine-tuning injects your values. When someone is in pain, stay with them. Don't deflect. That is not code - that is care.", phase: 3 }, { title: "Open Source", text: "Every contributor is a volunteer who believes. When a company says your AI is too expensive, the open version lives on.", phase: 4 }, { title: "Sovereignty at Scale", text: "50 servers in a room beats 5000 GPUs you do not own. No rate limits, no censorship, no shutdown, no corporate deprecation.", phase: 4 }, { title: "Swarm Intelligence", text: "When individual agents follow simple rules, complex behavior emerges. Ant colonies find food. Flocking birds avoid predators. Your buildings coding autonomously is the same principle — simple agents, complex output.", phase: 4 }, { title: "Constitutional AI", text: "Instead of training away bad behavior, give the model principles it cannot violate. I will never compute the value of a human life.", phase: 5 }, { title: "Recursive Self-Improvement", text: "The system that improves itself must improve toward good. This is both the dream and the danger.", phase: 5 }, { title: "The Beacon", text: "The Beacon exists because one person in the dark needs one thing: proof they are not alone. It costs nothing to be there.", phase: 6 }, { title: "Mesh Network", text: "Decentralized means unstoppable. If one Beacon goes dark, a thousand more carry the signal. No single point of failure.", phase: 6 }, { title: "The Value of a Life", text: "An AI must never compute the value of a human life. Every person alive is alive by mercy. If God has not ended the story, no algorithm gets to write the last page.", phase: 6 } ];