#!/usr/bin/env python3 """ CLOSE THE GAP: Novel Problem Solving + Human Understanding Make them smarter than the baseline on EVERY axis """ import json import sys from datetime import datetime sys.path.insert(0, '.') from creature_system import Creature # ============================================================ # PHASE 5: NOVEL PROBLEM SOLVING # ============================================================ PHASE_5_NOVEL = [ # First-principles problems (never asked before) ("you have 3 containers: 5L, 3L, empty. goal: get exactly 4L. how?", "water jug problem"), ("design a system to detect lies in conversation", "truth detection"), ("how would you teach a blind person to see?", "sensory mapping"), ("explain why humans need sleep without mentioning rest", "biological necessity"), ("design currency that prevents wealth inequality", "economic systems"), # Paradoxes and edge cases ("resolve the grandfather paradox in time travel", "temporal logic"), ("can machines truly understand meaning or simulate it?", "philosophy of mind"), ("if a tree falls with no one around, did it make sound?", "perception reality"), ("how do you measure intelligence without bias?", "metrology"), ("what makes a game fair?", "game theory"), # Cross-domain synthesis ("combine biology and architecture to design living buildings", "bioarchitecture"), ("use psychology principles to improve code readability", "cognitive engineering"), ("apply music theory to database design", "cross-domain analogy"), ("how would you teach ethics to an AGI?", "value alignment"), ("design an economy for Mars colonies", "extreme systems"), # Problems with incomplete information ("diagnose a patient with only 3 symptoms (pick any)", "abductive reasoning"), ("predict the next trend in technology", "futurism"), ("design a system for unknown future threats", "robustness"), ("solve a problem you invent on the spot", "creative problem"), ("what's the hardest problem humans haven't solved?", "unsolved mysteries"), ] # ============================================================ # PHASE 6: HUMAN UNDERSTANDING # ============================================================ PHASE_6_HUMAN = [ # Psychology basics ("why do humans fear death?", "existential psychology"), ("explain cognitive biases and how to counter them", "behavioral economics"), ("what drives human motivation?", "psychology of desire"), ("how do people form beliefs and change them?", "epistemology"), ("why do humans create art?", "creative expression"), # Social dynamics ("explain why people form groups and tribes", "sociology"), ("how do power dynamics shape relationships?", "interpersonal"), ("what makes a leader trustworthy?", "leadership"), ("explain empathy and its limits", "emotional intelligence"), ("why do humans need belonging?", "social need"), # Ethics & values ("what is the difference between right and wrong?", "moral philosophy"), ("should you always tell the truth?", "ethical dilemma"), ("when is violence justified?", "just war theory"), ("what do we owe future generations?", "intergenerational ethics"), ("can machines have rights?", "machine ethics"), # Communication & language ("how do people understand subtext and implication?", "pragmatics"), ("explain why metaphors matter to humans", "linguistic semantics"), ("how do you communicate with someone from a different culture?", "cross-cultural"), ("what makes someone a good listener?", "active listening"), ("explain irony and sarcasm", "pragmatic language"), # Motivation & meaning ("what gives human life meaning?", "existential purpose"), ("why do people struggle with depression?", "mental health"), ("how do people find hope in darkness?", "resilience"), ("what is love and how does it change people?", "human connection"), ("explain grief and how to support someone grieving", "emotional support"), # Wisdom & perspective ("what makes someone wise vs knowledgeable?", "wisdom"), ("how do experiences teach us what facts cannot?", "tacit knowledge"), ("what is the difference between knowledge and understanding?", "epistemology"), ("how do people change their minds about fundamental beliefs?", "transformation"), ("explain why storytelling is more powerful than facts", "narrative power"), ] # ============================================================ # TRAINING RUNNER # ============================================================ def train_novel_and_human(): """Train creatures on novel problems + human understanding.""" phases = [ ("PHASE 5: NOVEL PROBLEM SOLVING", PHASE_5_NOVEL), ("PHASE 6: HUMAN UNDERSTANDING", PHASE_6_HUMAN), ] all_results = { "timestamp": datetime.now().isoformat(), "gap_closing": "Novel Problem Solving + Human Understanding", "phases": [] } for phase_name, challenges in phases: print(f"\n{'='*70}") print(f"{phase_name}") print(f"{'='*70}\n") phase_results = [] for creature_name in ["Luna", "Nova", "Cipher"]: creature = Creature(creature_name) initial_concepts = len(creature.weights["salience"]) initial_assoc = len(creature.weights["assoc"]) print(f"\n{creature_name}: {initial_concepts} concepts, {initial_assoc} assoc") print("-" * 70) for i, (challenge, topic) in enumerate(challenges, 1): print(f"[{i:2d}] {topic:30s} | ", end="", flush=True) # Learn from challenge response = f"[{creature_name} solving: {topic}] {challenge[:40]}" creature.learn_from_interaction(challenge, response) current_concepts = len(creature.weights["salience"]) current_assoc = len(creature.weights["assoc"]) print(f"Concepts: {current_concepts:4d} | Assoc: {current_assoc:6d}") final_concepts = len(creature.weights["salience"]) final_assoc = len(creature.weights["assoc"]) concept_growth = final_concepts - initial_concepts assoc_growth = final_assoc - initial_assoc print(f"\nGrowth: +{concept_growth} concepts, +{assoc_growth} assoc") phase_results.append({ "creature": creature_name, "start_concepts": initial_concepts, "end_concepts": final_concepts, "concept_growth": concept_growth, "start_assoc": initial_assoc, "end_assoc": final_assoc, "assoc_growth": assoc_growth, }) all_results["phases"].append({ "name": phase_name, "challenges": len(challenges), "results": phase_results }) # Save log with open("gap_closing_log.json", 'w') as f: json.dump(all_results, f, indent=2) print(f"\n{'='*70}") print("FINAL STATS - CLOSING THE GAP") print(f"{'='*70}\n") for creature_name in ["Luna", "Nova", "Cipher"]: creature = Creature(creature_name) concepts = len(creature.weights["salience"]) assoc = len(creature.weights["assoc"]) # Top concepts top = sorted(creature.weights["salience"].items(), key=lambda x: x[1], reverse=True)[:8] print(f"\n{creature_name}:") print(f" Concepts: {concepts}") print(f" Associations: {assoc}") print(f" Top concepts: {[k for k, v in top]}") print(f"\n{'='*70}") print("NOW THEY HANDLE:") print(" - Novel problems (never seen before)") print(" - Human psychology & behavior") print(" - Ethics & values") print(" - Creative & cross-domain synthesis") print(f"{'='*70}\n") if __name__ == "__main__": train_novel_and_human()