import gradio as gr # ============================================================================= # BIBLE STORY TEMPLATES - Structured Data for Game Config Generation # Priority: Locations, People, Politics/Laws/Moral Rules # ============================================================================= BIBLE_TEMPLATES = { "matthew": { "book_name": "Gospel of Matthew", "youtube_link": "https://www.youtube.com/watch?v=mgUWg3ZY_C8", "chapters": { "1": { "title": "Jesus' Lineage", "summary": "Genealogy from Abraham to Jesus through David's line", "locations": [ {"name": "Bethlehem", "type": "city", "significance": "Birthplace of Jesus, City of David"}, {"name": "Judea", "type": "region", "significance": "Southern kingdom, seat of Jewish religious authority"} ], "people": [ {"name": "Abraham", "role": "ancestor", "faction": "Patriarchs", "description": "Father of the Jewish nation"}, {"name": "David", "role": "ancestor", "faction": "Kings of Israel", "description": "Greatest king, promised eternal dynasty"}, {"name": "Joseph", "role": "protagonist_support", "faction": "House of David", "description": "Carpenter, legal father of Jesus"}, {"name": "Mary", "role": "protagonist_support", "faction": "House of David", "description": "Virgin mother of Jesus"}, {"name": "Jesus", "role": "protagonist", "faction": "Divine", "description": "The Messiah, Son of God"} ], "politics_laws_morals": [ {"type": "law", "name": "Mosaic Law", "description": "Jewish religious and civil law governing all aspects of life"}, {"type": "moral", "name": "Righteousness through lineage", "description": "Importance of family line and covenant promises"}, {"type": "political", "name": "Davidic Covenant", "description": "God's promise of eternal kingship to David's descendants"} ] }, "2": { "title": "King Herod's Order", "summary": "Magi visit, flight to Egypt, massacre of innocents", "locations": [ {"name": "Bethlehem", "type": "city", "significance": "Where Jesus was born, target of Herod's massacre"}, {"name": "Jerusalem", "type": "capital", "significance": "Herod's seat of power, religious center"}, {"name": "Egypt", "type": "foreign_land", "significance": "Place of refuge, echoes of Exodus"}, {"name": "Nazareth", "type": "town", "significance": "Final settlement of the holy family"} ], "people": [ {"name": "Herod the Great", "role": "antagonist", "faction": "Roman Client Kings", "description": "Paranoid king who orders massacre of infants"}, {"name": "The Magi", "role": "ally", "faction": "Eastern Wise Men", "description": "Foreign astrologers who seek the newborn king"}, {"name": "Joseph", "role": "protagonist_support", "faction": "House of David", "description": "Protector who flees with family to Egypt"}, {"name": "Mary", "role": "protagonist_support", "faction": "House of David", "description": "Mother protecting her child"}, {"name": "Jesus", "role": "protagonist", "faction": "Divine", "description": "Infant king, target of Herod's jealousy"} ], "politics_laws_morals": [ {"type": "political", "name": "Roman Occupation", "description": "Judea under Roman rule through client kings"}, {"type": "political", "name": "Herodian Paranoia", "description": "Herod kills anyone threatening his throne, including family"}, {"type": "moral", "name": "Protection of the innocent", "description": "Joseph acts on divine warning to save his family"}, {"type": "moral", "name": "Sacrifice of innocents", "description": "Tragedy of children killed for one man's fear"}, {"type": "prophecy", "name": "Out of Egypt", "description": "Fulfillment of 'Out of Egypt I called my son'"} ] }, "3": { "title": "John the Baptist", "summary": "John prepares the way, Jesus is baptized", "locations": [ {"name": "Judean Wilderness", "type": "wilderness", "significance": "Place of repentance and preparation"}, {"name": "Jordan River", "type": "river", "significance": "Site of baptism, boundary crossing symbolism"} ], "people": [ {"name": "John the Baptist", "role": "herald", "faction": "Prophets", "description": "Voice crying in wilderness, prepares way for Messiah"}, {"name": "Jesus", "role": "protagonist", "faction": "Divine", "description": "Receives baptism to fulfill righteousness"}, {"name": "Pharisees", "role": "antagonist", "faction": "Religious Elite", "description": "Religious leaders challenged by John"}, {"name": "Sadducees", "role": "antagonist", "faction": "Religious Elite", "description": "Temple aristocracy, political collaborators"} ], "politics_laws_morals": [ {"type": "moral", "name": "Repentance", "description": "Turn from sin, change of heart and direction"}, {"type": "ritual", "name": "Baptism", "description": "Symbolic cleansing and public commitment"}, {"type": "moral", "name": "Bearing fruit", "description": "True repentance shown through changed actions"}, {"type": "warning", "name": "Judgment coming", "description": "Axe at root of trees, winnowing fork ready"} ] }, "4": { "title": "Temptation and First Disciples", "summary": "Jesus tempted by Satan, begins ministry, calls first disciples", "locations": [ {"name": "Judean Wilderness", "type": "wilderness", "significance": "40 days of fasting and temptation"}, {"name": "Temple Pinnacle", "type": "landmark", "significance": "Site of second temptation"}, {"name": "High Mountain", "type": "landmark", "significance": "Where Satan shows all kingdoms"}, {"name": "Galilee", "type": "region", "significance": "Jesus' ministry headquarters"}, {"name": "Capernaum", "type": "city", "significance": "Jesus' home base for ministry"}, {"name": "Sea of Galilee", "type": "body_of_water", "significance": "Where fishermen disciples are called"}, {"name": "Syria", "type": "region", "significance": "Fame spreads, sick brought from here"} ], "people": [ {"name": "Jesus", "role": "protagonist", "faction": "Divine", "description": "Overcomes temptation, begins public ministry"}, {"name": "Satan", "role": "antagonist", "faction": "Demonic", "description": "The tempter, offers worldly power"}, {"name": "Peter (Simon)", "role": "ally", "faction": "Disciples", "description": "Fisherman, first called disciple"}, {"name": "Andrew", "role": "ally", "faction": "Disciples", "description": "Peter's brother, also a fisherman"}, {"name": "James son of Zebedee", "role": "ally", "faction": "Disciples", "description": "Fisherman, one of inner circle"}, {"name": "John son of Zebedee", "role": "ally", "faction": "Disciples", "description": "James' brother, beloved disciple"} ], "politics_laws_morals": [ {"type": "moral", "name": "Scripture as defense", "description": "Jesus counters temptation with 'It is written'"}, {"type": "moral", "name": "Man shall not live by bread alone", "description": "Spiritual sustenance over physical"}, {"type": "moral", "name": "Do not test God", "description": "Faith doesn't demand proof through stunts"}, {"type": "moral", "name": "Worship God alone", "description": "Reject all other powers and kingdoms"}, {"type": "calling", "name": "Fishers of men", "description": "New purpose for disciples - gathering people"} ] }, "5": { "title": "Sermon on the Mount - Part 1", "summary": "Beatitudes, salt and light, fulfilling the law", "locations": [ {"name": "Mountain in Galilee", "type": "landmark", "significance": "Site of greatest sermon, new Sinai"} ], "people": [ {"name": "Jesus", "role": "protagonist", "faction": "Divine", "description": "Teacher giving new interpretation of law"}, {"name": "Disciples", "role": "ally", "faction": "Disciples", "description": "Inner circle receiving teaching"}, {"name": "Crowds", "role": "neutral", "faction": "Common People", "description": "Masses drawn to Jesus' teaching"}, {"name": "Pharisees", "role": "antagonist", "faction": "Religious Elite", "description": "Referenced as example of insufficient righteousness"} ], "politics_laws_morals": [ {"type": "moral", "name": "Beatitudes", "description": "Blessed are the poor in spirit, mourning, meek, hungry for righteousness, merciful, pure, peacemakers, persecuted"}, {"type": "moral", "name": "Salt and Light", "description": "Believers must preserve and illuminate the world"}, {"type": "law", "name": "Law fulfilled not abolished", "description": "Jesus completes the law's true meaning"}, {"type": "moral", "name": "Righteousness exceeding Pharisees", "description": "External compliance insufficient, heart matters"}, {"type": "moral", "name": "Anger equals murder", "description": "Heart attitude as serious as the act"}, {"type": "moral", "name": "Lust equals adultery", "description": "Internal sin as serious as external"}, {"type": "moral", "name": "Cut off what causes sin", "description": "Radical measures against temptation"}, {"type": "law", "name": "Divorce only for unfaithfulness", "description": "Stricter standard than Moses allowed"}, {"type": "moral", "name": "Let yes be yes", "description": "No oaths needed for honest people"}, {"type": "moral", "name": "Turn the other cheek", "description": "Non-retaliation, absorb evil"}, {"type": "moral", "name": "Love your enemies", "description": "Radical love extending to persecutors"} ] }, "6": { "title": "Sermon on the Mount - Part 2", "summary": "Secret righteousness, Lord's Prayer, treasures in heaven", "locations": [ {"name": "Mountain in Galilee", "type": "landmark", "significance": "Continuation of sermon"} ], "people": [ {"name": "Jesus", "role": "protagonist", "faction": "Divine", "description": "Teaching on authentic spirituality"}, {"name": "Disciples", "role": "ally", "faction": "Disciples", "description": "Learning to pray and trust"}, {"name": "Hypocrites", "role": "antagonist", "faction": "Religious Elite", "description": "Those who practice piety for show"} ], "politics_laws_morals": [ {"type": "moral", "name": "Secret giving", "description": "Give to needy without announcement or recognition"}, {"type": "moral", "name": "Secret prayer", "description": "Pray in private, not for public display"}, {"type": "prayer", "name": "Lord's Prayer", "description": "Model prayer: hallowed name, kingdom come, daily bread, forgiveness, deliverance"}, {"type": "moral", "name": "Forgive to be forgiven", "description": "Receiving forgiveness linked to giving it"}, {"type": "moral", "name": "Secret fasting", "description": "Fast without showing it to others"}, {"type": "moral", "name": "Treasures in heaven", "description": "Store up eternal rewards, not earthly wealth"}, {"type": "moral", "name": "Eye as lamp", "description": "What you focus on determines your inner state"}, {"type": "moral", "name": "Cannot serve God and money", "description": "Divided loyalty impossible"}, {"type": "moral", "name": "Do not worry", "description": "Trust God for provision like birds and flowers"}, {"type": "moral", "name": "Seek first the kingdom", "description": "Priority of God's kingdom, other needs follow"} ] }, "7": { "title": "Sermon on the Mount - Part 3", "summary": "Judging others, ask-seek-knock, narrow gate, wise builder", "locations": [ {"name": "Mountain in Galilee", "type": "landmark", "significance": "Conclusion of sermon"} ], "people": [ {"name": "Jesus", "role": "protagonist", "faction": "Divine", "description": "Concluding with warnings and wisdom"}, {"name": "Disciples", "role": "ally", "faction": "Disciples", "description": "Called to build on solid foundation"}, {"name": "False prophets", "role": "antagonist", "faction": "Deceivers", "description": "Wolves in sheep's clothing"}, {"name": "Crowds", "role": "neutral", "faction": "Common People", "description": "Amazed at teaching with authority"} ], "politics_laws_morals": [ {"type": "moral", "name": "Do not judge hypocritically", "description": "Remove own plank before addressing others' speck"}, {"type": "moral", "name": "Pearls before swine", "description": "Discernment about sharing sacred things"}, {"type": "moral", "name": "Ask, seek, knock", "description": "Persistent prayer receives answer"}, {"type": "moral", "name": "Golden Rule", "description": "Do to others what you want done to you"}, {"type": "moral", "name": "Narrow gate", "description": "Few find the difficult path to life"}, {"type": "warning", "name": "False prophets known by fruit", "description": "Actions reveal true nature"}, {"type": "warning", "name": "Not everyone saying Lord Lord", "description": "Relationship over religious activity"}, {"type": "moral", "name": "Wise and foolish builders", "description": "Hearing and doing vs hearing only"} ] }, "8": { "title": "Healings and Authority", "summary": "Jesus heals many, calms storm, casts out demons", "locations": [ {"name": "Capernaum", "type": "city", "significance": "Base of ministry, centurion's servant healed"}, {"name": "Peter's House", "type": "building", "significance": "Peter's mother-in-law healed"}, {"name": "Sea of Galilee", "type": "body_of_water", "significance": "Storm calmed, disciples' faith tested"}, {"name": "Region of Gadarenes", "type": "region", "significance": "Two demon-possessed men healed, pigs drowned"} ], "people": [ {"name": "Jesus", "role": "protagonist", "faction": "Divine", "description": "Demonstrates authority over sickness, nature, demons"}, {"name": "Man with leprosy", "role": "supplicant", "faction": "Outcast", "description": "Cleansed by Jesus' touch"}, {"name": "Roman Centurion", "role": "ally", "faction": "Roman Military", "description": "Gentile with great faith for servant's healing"}, {"name": "Peter's mother-in-law", "role": "recipient", "faction": "Disciples' Family", "description": "Healed of fever, immediately serves"}, {"name": "Disciples", "role": "ally", "faction": "Disciples", "description": "Fearful in storm, amazed at Jesus' power"}, {"name": "Two demon-possessed men", "role": "recipient", "faction": "Outcast", "description": "Violent men freed from Legion of demons"}, {"name": "Abraham, Isaac, Jacob", "role": "reference", "faction": "Patriarchs", "description": "Gentiles will feast with them in kingdom"} ], "politics_laws_morals": [ {"type": "law", "name": "Show yourself to priest", "description": "Jesus respects Mosaic law for cleansing verification"}, {"type": "moral", "name": "Faith over nationality", "description": "Centurion's faith exceeds Israel's"}, {"type": "warning", "name": "Sons of kingdom thrown out", "description": "Jewish privilege not automatic salvation"}, {"type": "cost", "name": "Foxes have holes", "description": "Following Jesus means homelessness"}, {"type": "cost", "name": "Let dead bury dead", "description": "Following Jesus takes absolute priority"}, {"type": "authority", "name": "Even winds and waves obey", "description": "Jesus has divine authority over creation"}, {"type": "spiritual", "name": "Demons recognize Jesus", "description": "Evil spirits know who Jesus is"} ] }, "9": { "title": "More Healings and Calling of Matthew", "summary": "Paralytic forgiven and healed, Matthew called, various healings", "locations": [ {"name": "Capernaum", "type": "city", "significance": "Jesus' own town, paralytic healed"}, {"name": "Tax collector's booth", "type": "workplace", "significance": "Matthew's place of work"}, {"name": "Matthew's house", "type": "building", "significance": "Dinner with tax collectors and sinners"}, {"name": "Ruler's house", "type": "building", "significance": "Where dead girl is raised"}, {"name": "Towns and villages", "type": "region", "significance": "Jesus' teaching circuit"} ], "people": [ {"name": "Jesus", "role": "protagonist", "faction": "Divine", "description": "Claims authority to forgive sins"}, {"name": "Paralytic man", "role": "recipient", "faction": "Common People", "description": "Lowered through roof, sins forgiven, then healed"}, {"name": "Matthew/Levi", "role": "ally", "faction": "Tax Collectors", "description": "Tax collector who becomes disciple and gospel writer"}, {"name": "Pharisees", "role": "antagonist", "faction": "Religious Elite", "description": "Question Jesus eating with sinners"}, {"name": "John's disciples", "role": "questioner", "faction": "John the Baptist", "description": "Ask about fasting practices"}, {"name": "Synagogue ruler", "role": "supplicant", "faction": "Religious Leaders", "description": "Daughter dies, raised by Jesus"}, {"name": "Woman with bleeding", "role": "recipient", "faction": "Outcast", "description": "12 years suffering, healed by touching cloak"}, {"name": "Two blind men", "role": "recipient", "faction": "Disabled", "description": "Healed according to their faith"}, {"name": "Mute demon-possessed man", "role": "recipient", "faction": "Possessed", "description": "Speaks after demon driven out"} ], "politics_laws_morals": [ {"type": "authority", "name": "Son of Man forgives sins", "description": "Jesus claims divine prerogative"}, {"type": "moral", "name": "Healthy don't need doctor", "description": "Jesus comes for sinners, not self-righteous"}, {"type": "moral", "name": "Mercy not sacrifice", "description": "God desires compassion over ritual"}, {"type": "teaching", "name": "New wine in new wineskins", "description": "Jesus brings new covenant, not patching old"}, {"type": "faith", "name": "Your faith has healed you", "description": "Faith as conduit for healing power"}, {"type": "warning", "name": "Harvest plentiful, workers few", "description": "Need for more disciples to reach people"}, {"type": "accusation", "name": "By prince of demons", "description": "Pharisees accuse Jesus of satanic power"} ] }, "10": { "title": "Sending Out the Twelve", "summary": "Twelve apostles commissioned with authority and warnings", "locations": [ {"name": "Israel", "type": "nation", "significance": "Mission field limited to lost sheep of Israel"}, {"name": "Towns and villages", "type": "region", "significance": "Where disciples are sent"}, {"name": "Sodom and Gomorrah", "type": "reference", "significance": "Judgment comparison for rejecting towns"} ], "people": [ {"name": "Jesus", "role": "protagonist", "faction": "Divine", "description": "Commissions and instructs the Twelve"}, {"name": "Peter", "role": "ally", "faction": "Twelve Apostles", "description": "Listed first among apostles"}, {"name": "Andrew", "role": "ally", "faction": "Twelve Apostles", "description": "Peter's brother"}, {"name": "James son of Zebedee", "role": "ally", "faction": "Twelve Apostles", "description": "One of inner three"}, {"name": "John", "role": "ally", "faction": "Twelve Apostles", "description": "Brother of James"}, {"name": "Philip", "role": "ally", "faction": "Twelve Apostles", "description": "From Bethsaida"}, {"name": "Bartholomew", "role": "ally", "faction": "Twelve Apostles", "description": "Also called Nathanael"}, {"name": "Thomas", "role": "ally", "faction": "Twelve Apostles", "description": "Later known as doubter"}, {"name": "Matthew", "role": "ally", "faction": "Twelve Apostles", "description": "The tax collector"}, {"name": "James son of Alphaeus", "role": "ally", "faction": "Twelve Apostles", "description": "The lesser James"}, {"name": "Thaddaeus", "role": "ally", "faction": "Twelve Apostles", "description": "Also called Judas son of James"}, {"name": "Simon the Zealot", "role": "ally", "faction": "Twelve Apostles", "description": "Former political revolutionary"}, {"name": "Judas Iscariot", "role": "traitor", "faction": "Twelve Apostles", "description": "The one who would betray Jesus"} ], "politics_laws_morals": [ {"type": "mission", "name": "Go to lost sheep of Israel", "description": "Initial mission limited to Jews, not Gentiles or Samaritans"}, {"type": "provision", "name": "Freely received, freely give", "description": "No payment for healing ministry"}, {"type": "provision", "name": "Worker deserves his keep", "description": "Depend on hospitality, travel light"}, {"type": "judgment", "name": "Shake dust off feet", "description": "Symbolic rejection of rejecting towns"}, {"type": "warning", "name": "Sheep among wolves", "description": "Danger awaits, be shrewd as snakes"}, {"type": "warning", "name": "Handed over to councils", "description": "Persecution by religious and civil authorities"}, {"type": "promise", "name": "Spirit will speak through you", "description": "Divine help in persecution"}, {"type": "warning", "name": "Family betrayal", "description": "Even family members will turn against believers"}, {"type": "cost", "name": "Take up cross", "description": "Following Jesus means death to self"}, {"type": "promise", "name": "Whoever receives you receives me", "description": "Disciples represent Jesus himself"} ] }, "11": { "title": "Jesus and John the Baptist", "summary": "John's question from prison, Jesus' testimony about John, woes on unrepentant cities", "locations": [ {"name": "Prison", "type": "building", "significance": "Where John is held by Herod Antipas"}, {"name": "Chorazin", "type": "city", "significance": "Unrepentant city despite miracles"}, {"name": "Bethsaida", "type": "city", "significance": "Unrepentant city despite miracles"}, {"name": "Capernaum", "type": "city", "significance": "Jesus' base, will be brought down to Hades"}, {"name": "Tyre", "type": "city", "significance": "Gentile city that would have repented"}, {"name": "Sidon", "type": "city", "significance": "Gentile city that would have repented"}, {"name": "Sodom", "type": "reference", "significance": "Would have remained if it saw Jesus' miracles"} ], "people": [ {"name": "Jesus", "role": "protagonist", "faction": "Divine", "description": "Praises John, condemns unrepentant cities"}, {"name": "John the Baptist", "role": "ally", "faction": "Prophets", "description": "In prison, sends disciples to ask if Jesus is the one"}, {"name": "John's disciples", "role": "messenger", "faction": "John the Baptist", "description": "Carry question to Jesus and answer back"}, {"name": "Elijah", "role": "reference", "faction": "Prophets", "description": "John is Elijah who was to come"} ], "politics_laws_morals": [ {"type": "proof", "name": "Deeds prove identity", "description": "Blind see, lame walk, dead raised - proof Jesus is Messiah"}, {"type": "honor", "name": "Greatest born of women", "description": "John's unique role in salvation history"}, {"type": "paradox", "name": "Least in kingdom is greater", "description": "New covenant position exceeds old"}, {"type": "warning", "name": "Kingdom suffers violence", "description": "Forceful opposition since John's ministry"}, {"type": "criticism", "name": "This generation like children", "description": "Neither John's asceticism nor Jesus' fellowship satisfied critics"}, {"type": "judgment", "name": "Woe to unrepentant cities", "description": "Greater light means greater accountability"}, {"type": "revelation", "name": "Hidden from wise, revealed to children", "description": "God's reversal of expected recipients"}, {"type": "invitation", "name": "Come to me, all weary", "description": "Jesus offers rest from religious burden"}, {"type": "promise", "name": "My yoke is easy", "description": "Jesus' way lighter than Pharisaic law"} ] } } } } # ============================================================================= # HELPER FUNCTIONS # ============================================================================= def get_all_locations(book="matthew"): """Extract all unique locations from a book""" locations = [] if book in BIBLE_TEMPLATES: for chapter_num, chapter in BIBLE_TEMPLATES[book]["chapters"].items(): for loc in chapter.get("locations", []): if loc not in locations: locations.append(loc) return locations def get_all_people(book="matthew"): """Extract all unique people from a book""" people = {} if book in BIBLE_TEMPLATES: for chapter_num, chapter in BIBLE_TEMPLATES[book]["chapters"].items(): for person in chapter.get("people", []): if person["name"] not in people: people[person["name"]] = person return list(people.values()) def get_all_politics_laws_morals(book="matthew"): """Extract all unique politics/laws/morals from a book""" plm = [] seen = set() if book in BIBLE_TEMPLATES: for chapter_num, chapter in BIBLE_TEMPLATES[book]["chapters"].items(): for item in chapter.get("politics_laws_morals", []): key = (item["type"], item["name"]) if key not in seen: seen.add(key) plm.append(item) return plm def get_chapter_data(book="matthew", chapter="1"): """Get all data for a specific chapter""" if book in BIBLE_TEMPLATES and chapter in BIBLE_TEMPLATES[book]["chapters"]: return BIBLE_TEMPLATES[book]["chapters"][chapter] return None def format_locations_for_display(locations): """Format locations list as markdown""" if not locations: return "No locations defined" lines = ["| Location | Type | Significance |", "|----------|------|--------------|"] for loc in locations: lines.append(f"| {loc['name']} | {loc['type']} | {loc['significance']} |") return "\n".join(lines) def format_people_for_display(people): """Format people list as markdown""" if not people: return "No people defined" lines = ["| Name | Role | Faction | Description |", "|------|------|---------|-------------|"] for person in people: lines.append(f"| {person['name']} | {person['role']} | {person['faction']} | {person['description']} |") return "\n".join(lines) def format_politics_for_display(plm): """Format politics/laws/morals as markdown""" if not plm: return "No rules defined" lines = ["| Type | Name | Description |", "|------|------|-------------|"] for item in plm: lines.append(f"| {item['type']} | {item['name']} | {item['description']} |") return "\n".join(lines) def get_chapter_summary_md(book="matthew", chapter="1"): """Get formatted markdown summary for a chapter""" data = get_chapter_data(book, chapter) if not data: return "Chapter not found" md = f"## Chapter {chapter}: {data['title']}\n\n" md += f"**Summary:** {data['summary']}\n\n" md += "### Locations\n" + format_locations_for_display(data.get("locations", [])) + "\n\n" md += "### People\n" + format_people_for_display(data.get("people", [])) + "\n\n" md += "### Politics, Laws & Moral Rules\n" + format_politics_for_display(data.get("politics_laws_morals", [])) return md def generate_game_elements_from_chapter(book="matthew", chapter="1"): """Generate game config elements from a chapter""" data = get_chapter_data(book, chapter) if not data: return {} # Convert to game config format config_elements = { "setting": { "title": data["title"], "description": data["summary"], "locations": {loc["name"]: {"type": loc["type"], "description": loc["significance"]} for loc in data.get("locations", [])} }, "characters": { person["name"]: { "role": person["role"], "faction": person["faction"], "description": person["description"] } for person in data.get("people", []) }, "rules": [ {"type": item["type"], "name": item["name"], "effect": item["description"]} for item in data.get("politics_laws_morals", []) ] } return config_elements # ============================================================================= # GRADIO UI # ============================================================================= def bible_story_elements(): with gr.Tab("Using Bible as Inspiration") as story_inspiration: gr.Markdown(""" # Bible Story Templates for Game Config Generation Use these structured templates to generate game configs based on Biblical narratives. Each chapter is broken down into **Locations**, **People**, and **Politics/Laws/Moral Rules**. """) with gr.Tab("Matthew Overview"): gr.Markdown(f"**Source:** [{BIBLE_TEMPLATES['matthew']['book_name']}]({BIBLE_TEMPLATES['matthew']['youtube_link']})") # Summary stats all_locs = get_all_locations("matthew") all_people = get_all_people("matthew") all_plm = get_all_politics_laws_morals("matthew") gr.Markdown(f""" ### Template Statistics (Chapters 1-11) - **Locations:** {len(all_locs)} unique places - **People:** {len(all_people)} unique characters - **Rules/Morals:** {len(all_plm)} unique laws, morals, and political elements """) with gr.Accordion("All Locations", open=False): gr.Markdown(format_locations_for_display(all_locs)) with gr.Accordion("All People", open=False): gr.Markdown(format_people_for_display(all_people)) with gr.Accordion("All Politics/Laws/Morals", open=False): gr.Markdown(format_politics_for_display(all_plm)) with gr.Tab("Chapter Browser"): chapter_dropdown = gr.Dropdown( choices=[(f"Chapter {k}: {v['title']}", k) for k, v in BIBLE_TEMPLATES["matthew"]["chapters"].items()], label="Select Chapter", value="1" ) chapter_display = gr.Markdown(get_chapter_summary_md("matthew", "1")) chapter_dropdown.change( fn=lambda ch: get_chapter_summary_md("matthew", ch), inputs=[chapter_dropdown], outputs=[chapter_display] ) with gr.Tab("Generate Game Elements"): gr.Markdown("Select a chapter to generate game config elements from its narrative structure.") gen_chapter = gr.Dropdown( choices=[(f"Chapter {k}: {v['title']}", k) for k, v in BIBLE_TEMPLATES["matthew"]["chapters"].items()], label="Select Chapter", value="1" ) def random_bible_chapter(): """Select a random chapter from available chapters.""" import random chapters = list(BIBLE_TEMPLATES["matthew"]["chapters"].keys()) return random.choice(chapters) with gr.Row(): random_chapter_btn = gr.Button("🎲 Random Chapter", variant="secondary") generate_btn = gr.Button("Generate Game Elements", variant="primary") output_json = gr.Code(language="json", label="Generated Game Elements") random_chapter_btn.click( fn=random_bible_chapter, outputs=[gen_chapter] ) import json generate_btn.click( fn=lambda ch: json.dumps(generate_game_elements_from_chapter("matthew", ch), indent=2), inputs=[gen_chapter], outputs=[output_json] ) return story_inspiration