From ae5e9fdcd87dadb9fbf53de85b2695927c826e14 Mon Sep 17 00:00:00 2001 From: Sienna Meridian Satterwhite Date: Sun, 8 Feb 2026 15:46:52 +0000 Subject: [PATCH] docs: add Alice in Wonderland example storybook Add comprehensive example demonstrating all major features of the Storybook DSL through Lewis Carroll's Alice in Wonderland. Contents: - 12 characters (Alice, WhiteRabbit, CheshireCat, MadHatter, etc.) - 7 relationships with named participant blocks - 3 institutions (tea parties, royal court) - 1 schedule (Mad Tea Party eternal rotation) - 12 behavior trees using new syntax features - 1 life arc (Alice's journey) Demonstrates: - Cross-file template resolution (schema/templates.sb) - Template inheritance and includes - Strict template validation - Action parameters and repeater decorators - Named participant relationship blocks - Species-based character typing - Rich prose blocks throughout All content validates successfully. --- .gitignore | 2 + examples/alice-in-wonderland/README.md | 336 ++++++++++++++++++ examples/alice-in-wonderland/schema/beings.sb | 73 ++++ .../alice-in-wonderland/schema/core_enums.sb | 145 ++++++++ .../alice-in-wonderland/schema/templates.sb | 57 +++ examples/alice-in-wonderland/storybook.toml | 22 ++ .../world/characters/alice.sb | 110 ++++++ .../world/characters/caterpillar.sb | 155 ++++++++ .../world/characters/cheshire_cat.sb | 203 +++++++++++ .../world/characters/mad_tea_party.sb | 285 +++++++++++++++ .../world/characters/royal_court.sb | 315 ++++++++++++++++ .../world/characters/white_rabbit.sb | 75 ++++ .../institutions/wonderland_institutions.sb | 169 +++++++++ .../world/locations/wonderland_places.sb | 227 ++++++++++++ .../relationships/wonderland_relationships.sb | 278 +++++++++++++++ 15 files changed, 2452 insertions(+) create mode 100644 examples/alice-in-wonderland/README.md create mode 100644 examples/alice-in-wonderland/schema/beings.sb create mode 100644 examples/alice-in-wonderland/schema/core_enums.sb create mode 100644 examples/alice-in-wonderland/schema/templates.sb create mode 100644 examples/alice-in-wonderland/storybook.toml create mode 100644 examples/alice-in-wonderland/world/characters/alice.sb create mode 100644 examples/alice-in-wonderland/world/characters/caterpillar.sb create mode 100644 examples/alice-in-wonderland/world/characters/cheshire_cat.sb create mode 100644 examples/alice-in-wonderland/world/characters/mad_tea_party.sb create mode 100644 examples/alice-in-wonderland/world/characters/royal_court.sb create mode 100644 examples/alice-in-wonderland/world/characters/white_rabbit.sb create mode 100644 examples/alice-in-wonderland/world/institutions/wonderland_institutions.sb create mode 100644 examples/alice-in-wonderland/world/locations/wonderland_places.sb create mode 100644 examples/alice-in-wonderland/world/relationships/wonderland_relationships.sb diff --git a/.gitignore b/.gitignore index 46b5d68..0440ec4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /target .envrc +alice-in-wonderland.txt +alice-in-wonderland.txt diff --git a/examples/alice-in-wonderland/README.md b/examples/alice-in-wonderland/README.md new file mode 100644 index 0000000..4600421 --- /dev/null +++ b/examples/alice-in-wonderland/README.md @@ -0,0 +1,336 @@ +# Alice's Adventures in Wonderland - Storybook Example + +A comprehensive demonstration of the Storybook DSL, modeling Lewis Carroll's *Alice's Adventures in Wonderland* with accuracy to the source material and showcasing all advanced language features. + +## Overview + +This example shows how Storybook enables complex narrative modeling for agent simulation games. It demonstrates: + +- **Advanced behavior trees** for complex, context-dependent character actions +- **Life arcs** tracking transformative character journeys +- **Schedules** modeling eternal time loops and recurring events +- **Template composition** with inheritance and strict mode +- **Bidirectional relationships** with asymmetric perspectives +- **Cross-file references** creating an interconnected world model + +## Contents + +### Schema Layer + +**`schema/core_enums.sb`** +- Core value types used throughout: `Size`, `EmotionalState`, `CardSuit`, `CardRank`, `TimeState`, `ManifestationLevel` +- Demonstrates enumeration definitions + +**`schema/templates.sb`** +- Base template `WonderlandCreature` for all sentient beings +- Specialized templates with `include`: `SizeChanging`, `MadTeaPartyMember`, `Supernatural` +- **Strict template** `PlayingCard` enforcing concrete values +- Shows vertical inheritance (includes) and horizontal composition (multiple `from` clauses) + +**`schema/species.sb`** +- Species definitions: `Human`, `Rabbit`, `Cat`, `Hare`, `Dormouse`, `Caterpillar`, `PlayingCardPerson` +- Rich prose blocks describing characteristics and abilities + +### World Layer + +#### Characters + +**`alice.sb`** - The protagonist +- Inherits from `SizeChanging` template +- **Life arc `AliceJourney`** with states: `falling`, `tiny_alice`, `giant_alice`, `normal_alice_garden`, `enlightened_alice` +- Shows how life arcs track transformative journeys with state-specific field modifications + +**`white_rabbit.sb`** - The anxious herald +- **Behavior tree `WhiteRabbit_ConstantlyLate`** using selectors (`?`) and sequences (`>`) +- Demonstrates hierarchical behavior modeling with panic strategies + +**`cheshire_cat.sb`** - The enigmatic guide +- **Three behavior trees**: + - `CheshireCat_AppearDisappear` - context-dependent materialization + - `CheshireCat_GradualManifestation` - piece-by-piece appearance (grin first!) + - `CheshireCat_GradualDematerialization` - fading away (grin lingers longest) +- Shows complex multi-step sequences with timing and state transitions + +**`mad_tea_party.sb`** - The eternal tea party trio +- Three characters: `MadHatter`, `MarchHare`, `Dormouse` +- **Schedule `MadTeaPartyRotation`** modeling the time loop (always 6 o'clock) +- **Behavior `MadTeaParty_CoordinatedMadness`** showing multi-agent coordination +- Demonstrates repeater decorator (`*`) for infinite loops + +**`royal_court.sb`** - The Court of Hearts +- Characters: `QueenOfHearts`, `KingOfHearts`, `CardGardenerTwo`, `CardGardenerFive`, `CardGardenerSeven` +- Inherits from `PlayingCard` strict template - card suit/rank must be concrete +- **Behavior `QueenOfHearts_RagePattern`** - hair-trigger temper response +- **Behavior `KingOfHearts_SecretPardons`** - background mercy system + +**`caterpillar.sb`** - The philosophical teacher +- **Behavior `Caterpillar_SocraticMethod`** - interrogative teaching style +- Shows question-answer tree structures + +#### Locations + +**`wonderland_places.sb`** +- `RabbitHole`, `HallOfDoors`, `Garden`, `MadTeaPartyTable`, `CroquetGround`, `QueensPalace`, `MushroomTop` +- Each location has physical properties, symbolic meaning, and narrative significance +- Demonstrates rich prose blocks for description and analysis + +#### Institutions + +**`wonderland_institutions.sb`** +- `CourtOfHearts` - tyrannical monarchy with interesting power dynamics +- `MadTeaParty` - eternal social gathering stuck in time +- `WonderlandDreamLogic` - the meta-institution governing reality itself +- Shows how social structures can be modeled with hierarchies and rules + +#### Relationships + +**`wonderland_relationships.sb`** +- **Bidirectional relationships** with `self` and `other` blocks showing asymmetric perspectives: + - `AliceAndWhiteRabbit` - pursuer/unwitting guide + - `AliceAndCheshireCat` - seeker/amused observer + - `QueenAndKing` - tyrant/secret rebel + - `AliceAndCaterpillar` - frustrated student/Socratic teacher +- Demonstrates how different characters perceive the same relationship differently + +#### Behaviors + +**`alice_behaviors.sb`** - Alice's strategic behaviors +- `Alice_SizeManagement` - learning to control size through trial and error +- `Alice_NavigateConversation` - dealing with nonsensical logic +- `Alice_EmotionalJourney` - state transitions from curiosity to enlightenment +- `Alice_ProblemSolving` - adapting normal-world logic to Wonderland + +## Language Features Demonstrated + +### 1. Template Composition + +```storybook +template WonderlandCreature { + current_size: Size + emotional_state: EmotionalState + follows_logic: false..true +} + +template SizeChanging { + include WonderlandCreature + natural_size: Size + size_changes_today: 0..50 +} + +character Alice from SizeChanging { + // Inherits all fields from WonderlandCreature and SizeChanging + age: 7 + current_size: normal +} +``` + +### 2. Strict Templates + +```storybook +template strict PlayingCard { + suit: CardSuit + rank: CardRank + // Characters using this template MUST provide concrete values +} + +character QueenOfHearts from PlayingCard { + suit: hearts // Required: must be concrete enum value + rank: queen // Required: must be concrete enum value +} +``` + +### 3. Life Arcs + +```storybook +life_arc AliceJourney { + state tiny_alice { + on enter { + Alice.current_size: tiny + Alice.size_changes_today: +1 + } + } + + state giant_alice { + on enter { + Alice.current_size: huge + } + } +} +``` + +### 4. Schedules + +```storybook +schedule MadTeaPartyRotation { + 18:00 -> 18:01: TeaRound { } + 18:01 -> 18:02: RiddlePhase { } + // ... more phases + 18:05 -> 18:00: LoopToBeginning { } // Loops back! +} +``` + +### 5. Behavior Trees + +```storybook +behavior CheshireCat_AppearDisappear { + ? { // Selector: try branches until one succeeds + > { // Sequence: all must succeed in order + IsInvisible + DecideToAppear + GradualManifestation + } + > { + IsVisible + DecideToLeave + GradualDematerialization + } + } +} +``` + +### 6. Repeater Decorator + +```storybook +behavior MadTeaParty_CoordinatedMadness { + * { // Repeater: loop forever + ? { + > { AskRiddle; ReceiveNoAnswer } + > { RotateSeats; CheckTime } + } + } +} +``` + +### 7. Bidirectional Relationships + +```storybook +relationship QueenAndKing { + QueenOfHearts + KingOfHearts + + bond: 0.4 + + self { + // Queen's perspective + role: dominant_spouse + aware_of_pardons: false + } + + other { + // King's perspective + role: secret_moderator + subverts_authority: 1.0 + } +} +``` + +### 8. Rich Prose Blocks + +```storybook +character CheshireCat { + ---description + A large cat with a permanent, unsettling grin. Possesses the + ability to appear and disappear at will, often leaving only + its grin behind. + --- + + ---philosophy + The Cheshire Cat represents the absurdist nature of Wonderland + itself. His vanishing act defies physical law but seems + perfectly natural in Wonderland's logic. + --- +} +``` + +### 9. Cross-File References + +```storybook +// In alice.sb +use schema::core_enums::{Size, EmotionalState}; +use schema::templates::SizeChanging; + +character Alice from SizeChanging { + current_size: normal // Uses Size enum from core_enums +} +``` + +### 10. Field Modifications in Life Arcs + +```storybook +state enlightened_alice { + on enter { + Alice.emotional_state: brave + Alice.awareness_of_absurdity: 1.0 // Absolute assignment + Alice.size_changes_today: +1 // Increment + } +} +``` + +## Accuracy to Source Material + +This example stays faithful to Carroll's original text: + +- **Mad Tea Party**: Time frozen at 6 o'clock, rotating seats, butter in the watch +- **Cheshire Cat**: Grin appearing first/last, cryptic directions, "we're all mad here" +- **Queen of Hearts**: Constant "Off with their heads!", card gardeners, croquet with flamingos +- **Alice's transformations**: Specific size states from the book +- **Caterpillar's advice**: Terse questions, mushroom sides +- **Character dynamics**: White Rabbit's anxiety, Dormouse's drowsiness, King's secret mercy + +## Running the Example + +```bash +# Validate the entire project +sb validate examples/alice-in-wonderland/ + +# Query characters +sb query "characters where follows_logic == false" + +# Inspect a specific character +sb inspect Alice + +# Show all relationships +sb query "relationships where bond > 0.5" +``` + +## What This Demonstrates + +### For Content Authors (Lonni) + +- **Rich character modeling**: Personality traits, motivations, relationships +- **Narrative structure**: Life arcs track character journeys +- **World building**: Locations, institutions, social dynamics +- **Prose integration**: Backstories, descriptions, and philosophical notes + +### For Developers (Sienna) + +- **Complex behavior trees**: Multi-level selectors, sequences, repeaters +- **State management**: Life arcs with field modifications +- **Scheduling systems**: Time loops and recurring events +- **Type safety**: Strict templates enforce constraints +- **Cross-referencing**: Build interconnected world models + +### For Agent Simulation + +This model could drive an agent-based simulation where: + +- Alice's behavior tree decides how to navigate conversations and obstacles +- The Mad Tea Party schedule creates a time-loop environment +- Cheshire Cat's appearance/disappearance behavior creates mystery +- Queen's rage pattern generates conflict +- Relationships determine interaction dynamics + +## Extending This Example + +Ideas for additions: + +- **More chapters**: Mock Turtle, Gryphon, Trial scene +- **Croquet game logic**: Behavior trees for live hedgehog/flamingo equipment +- **Size change mechanics**: Fine-grained mushroom nibbling behavior +- **Dream logic system**: Meta-rules governing Wonderland physics +- **Alice's awakening**: Final life arc state transitioning back to reality + +## License + +Source material: *Alice's Adventures in Wonderland* by Lewis Carroll (public domain) +Storybook adaptation: MIT License diff --git a/examples/alice-in-wonderland/schema/beings.sb b/examples/alice-in-wonderland/schema/beings.sb new file mode 100644 index 0000000..14aa65a --- /dev/null +++ b/examples/alice-in-wonderland/schema/beings.sb @@ -0,0 +1,73 @@ +//! Species definitions for Wonderland inhabitants + +species Human { + lifespan: 70 + ---description + Visitors from the normal world above. Rare in Wonderland. + Subject to size-changing effects of local flora. + --- +} + +species Rabbit { + lifespan: 10 + ---description + Wonderland rabbits often wear waistcoats, carry pocket watches, + and exhibit extreme punctuality anxiety. May be anthropomorphic. + --- +} + +species Cat { + lifespan: 15 + ---description + Cheshire variety can vanish at will, leaving only a grin. + Ordinary cats (like Dinah) remain in the world above. + --- +} + +species Hare { + lifespan: 8 + ---description + March Hares display heightened madness, especially during + breeding season. Often found at eternal tea parties. + --- +} + +species Dormouse { + lifespan: 5 + ---description + Extremely somnolent. Can sleep through tea parties, pinching, + and being used as a cushion. Occasionally recites tales in sleep. + --- +} + +species Caterpillar { + lifespan: 1 + ---description + Large, blue, hookah-smoking variety. Philosophically inclined. + Offers cryptic advice about size-changing mushrooms. + --- +} + +species PlayingCardPerson { + lifespan: 100 + ---description + Animated playing cards forming the Court of Hearts hierarchy. + Flat, rectangular bodies. Gardeners, soldiers, and royalty. + --- +} + +species Flamingo { + lifespan: 40 + ---description + Unwilling participants in croquet as live mallets. + Tendency to look back at player with puzzled expressions. + --- +} + +species Hedgehog { + lifespan: 6 + ---description + Pressed into service as croquet balls. Frequently unroll + and wander away mid-game, frustrating players. + --- +} diff --git a/examples/alice-in-wonderland/schema/core_enums.sb b/examples/alice-in-wonderland/schema/core_enums.sb new file mode 100644 index 0000000..2d8610c --- /dev/null +++ b/examples/alice-in-wonderland/schema/core_enums.sb @@ -0,0 +1,145 @@ +//! Core enumerations for Wonderland domain modeling + +enum Size { + tiny, // 3 inches tall + small, // 1 foot tall + normal, // Human-sized + large, // 9 feet tall + huge // House-sized +} + +enum EmotionalState { + curious, + frightened, + confused, + brave, + angry, + melancholy, + amused +} + +enum CardSuit { + hearts, + diamonds, + clubs, + spades +} + +enum CardRank { + two, + three, + four, + five, + six, + seven, + eight, + nine, + ten, + knave, + queen, + king +} + +enum TimeState { + normal, + frozen, + reversed, + accelerated +} + +enum ManifestationLevel { + invisible, + fading_in, + partial_grin, + partial_body, + mostly_visible, + fully_visible, + fading_out +} + +enum GovernmentType { + monarchy, + democracy, + anarchy, + tyranny, + oligarchy +} + +enum GovernmentStyle { + absolute_tyranny, + benevolent_dictatorship, + constitutional_monarchy, + direct_democracy, + representative_democracy, + anarchist_collective +} + +enum HierarchyStyle { + rigid, + fluid, + flat, + nested, + circular +} + +enum Temperament { + volatile, + calm, + unpredictable, + steady, + chaotic +} + +enum Power { + queen_only, + king_only, + shared, + distributed, + none +} + +enum JudicialPresumption { + guilt, + innocence, + absurdity +} + +enum Sentence { + beheading, + banishment, + imprisonment, + fine, + warning, + pardon +} + +enum SeatRotation { + clockwise, + counterclockwise, + random, + none +} + +enum GatheringType { + eternal_social_gathering, + formal_ceremony, + casual_meeting, + spontaneous_assembly +} + +enum Purpose { + tea_consumption, + governance, + entertainment, + survival, + chaos +} + +enum Enforcement { + forbidden, + discouraged, + optional, + encouraged, + mandatory, + required +} diff --git a/examples/alice-in-wonderland/schema/templates.sb b/examples/alice-in-wonderland/schema/templates.sb new file mode 100644 index 0000000..b53bab9 --- /dev/null +++ b/examples/alice-in-wonderland/schema/templates.sb @@ -0,0 +1,57 @@ +//! Template definitions for Wonderland entities + +use schema::core_enums::{Size, EmotionalState}; + +// Base template for all sentient beings in Wonderland +template WonderlandCreature { + current_size: Size + emotional_state: EmotionalState + speaks_english: true + awareness_of_absurdity: 0.0..1.0 +} + +// Template for size-changing entities (Alice, mushrooms victims) +template SizeChanging { + include WonderlandCreature + + natural_size: Size + min_size: Size + max_size: Size + size_changes_today: 0..50 +} + +// Template for playing card entities +template PlayingCard strict { + include WonderlandCreature + + suit: CardSuit + rank: CardRank + fear_of_queen: 0.8..1.0 + follows_logic: false +} + +// Template for residents of the Mad Tea Party +template MadTeaPartyMember { + include WonderlandCreature + + stuck_at_teatime: true + riddles_asked: 0..1000 + follows_logic: false + current_seat_position: 0..100 +} + +// Template for royal court members +template CourtMember { + include WonderlandCreature + + loyalty_to_queen: 0.0..1.0 + times_threatened_with_beheading: 0..100 + survival_instinct: 0.5..1.0 +} + +// Template for mysterious/supernatural beings +template Supernatural { + include WonderlandCreature + + follows_logic: false +} diff --git a/examples/alice-in-wonderland/storybook.toml b/examples/alice-in-wonderland/storybook.toml new file mode 100644 index 0000000..7bf510c --- /dev/null +++ b/examples/alice-in-wonderland/storybook.toml @@ -0,0 +1,22 @@ +# Alice's Adventures in Wonderland - Storybook Example Project +# A comprehensive demonstration of all Storybook language features + +[project] +name = "alice-in-wonderland" +version = "1.0.0" +description = "Complete Alice in Wonderland narrative model showcasing advanced Storybook language features" +author = "Lewis Carroll (adapted)" + +[paths] +schema = "schema" +world = "world" + +[validation] +# Enable strict validation to catch errors +strict_mode = true + +# Warn about unused declarations +warn_unused = true + +# Require all cross-references to resolve +require_resolution = true diff --git a/examples/alice-in-wonderland/world/characters/alice.sb b/examples/alice-in-wonderland/world/characters/alice.sb new file mode 100644 index 0000000..dd86730 --- /dev/null +++ b/examples/alice-in-wonderland/world/characters/alice.sb @@ -0,0 +1,110 @@ +//! Alice: The protagonist navigating Wonderland's absurdities + +use schema::core_enums::{Size, EmotionalState}; +use schema::templates::SizeChanging; +use schema::beings::Human; + +character Alice: Human from SizeChanging { + // Core identity + age: 7 + natural_size: normal + current_size: normal + min_size: tiny + max_size: huge + size_changes_today: 12 + + // Personality traits + emotional_state: curious + follows_logic: true + awareness_of_absurdity: 0.9 + + // Wonderland-specific state + knows_multiplication: false // Gets confused underground + can_recite_poetry_correctly: false // Always gets verses wrong + + ---backstory + A curious young girl who followed a White Rabbit down a hole and + found herself in a world where logic fails, size is mutable, and + everyone speaks in riddles and contradictions. + + She tries to maintain her composure and Victorian manners even as + she shrinks to inches, grows to fill rooms, and encounters + impossible characters hosting impossible tea parties. + --- +} + +// Alice's transformative journey through Wonderland +life_arc AliceJourney { + ---description + Tracks Alice's physical and emotional transformations as she + navigates Wonderland's surreal challenges. Each state represents + a key phase of her adventure. + --- + + state falling { + on enter { + Alice.current_size: normal + Alice.emotional_state: curious + } + + ---narrative + Tumbling down the rabbit hole, Alice has time to wonder about + geography, Dinah the cat, and whether she'll fall through to + the Antipodes. The fall seems endless. + --- + } + + state tiny_alice { + on enter { + Alice.current_size: tiny + Alice.emotional_state: frightened + Alice.size_changes_today: 13 + } + + ---narrative + Only three inches tall, Alice can fit through the tiny door to + the garden but cannot reach the key on the glass table. She + finds herself crying a pool of tears. + --- + } + + state giant_alice { + on enter { + Alice.current_size: huge + Alice.emotional_state: confused + Alice.size_changes_today: 13 + } + + ---narrative + Grown so large her head hits the ceiling, Alice floods the hall + with her tears. The White Rabbit mistakes her giant arm for a + monster and attempts to burn the house down. + --- + } + + state normal_alice_garden { + on enter { + Alice.current_size: normal + Alice.emotional_state: brave + } + + ---narrative + Finally the right size, Alice enters the beautiful garden and + encounters the Queen's croquet ground, where flamingos serve + as mallets and hedgehogs as balls. + --- + } + + state enlightened_alice { + on enter { + Alice.emotional_state: brave + Alice.awareness_of_absurdity: 1.0 + } + + ---narrative + Having traversed the madness of Wonderland, Alice realizes + "you're nothing but a pack of cards!" Her awareness of the + absurdity grants her power over the dream. + --- + } +} diff --git a/examples/alice-in-wonderland/world/characters/caterpillar.sb b/examples/alice-in-wonderland/world/characters/caterpillar.sb new file mode 100644 index 0000000..b147e8f --- /dev/null +++ b/examples/alice-in-wonderland/world/characters/caterpillar.sb @@ -0,0 +1,155 @@ +//! The Caterpillar: Philosophical advisor and size-change expert + +use schema::core_enums::{Size, EmotionalState}; +use schema::templates::Supernatural; +use schema::beings::Caterpillar; + +character TheCaterpillar: Caterpillar from Supernatural { + // Physical traits + current_size: normal // Large for a caterpillar + color: blue + smoking_hookah: true + + // Personality + emotional_state: melancholy + follows_logic: false + awareness_of_absurdity: 1.0 + + // Supernatural/philosophical nature + can_disappear: false + defies_physics: true // A smoking caterpillar defies biology + offers_cryptic_advice: true + + // Communication style + speaks_in_short_questions: true + makes_alice_explain_herself: true + patient_with_confusion: false + + // Size-change knowledge + knows_mushroom_properties: true + understanding_of_transformation: 1.0 + + ---description + A large blue caterpillar sitting atop a mushroom, smoking + a hookah. Speaks in short, terse sentences, usually questions. + Forces Alice to confront her identity crisis through Socratic + method. + + Knows which side of the mushroom makes you taller, which side + makes you shorter. This knowledge is crucial for Alice's ability + to control her size changes. + --- + + ---philosophical_role + The Caterpillar represents transformation and the difficulty + of maintaining identity through change. He asks "Who are YOU?" + when Alice herself doesn't know anymore. + + His own impending transformation (chrysalis → butterfly) mirrors + Alice's transformation through Wonderland. Both are changing, + both struggle with "who am I?" + --- +} + +behavior Caterpillar_SocraticMethod { + ---description + The Caterpillar's interrogative conversation style. He asks + questions, contradicts answers, and forces self-examination. + --- + + > { + // Initial confrontation + > { + RemoveHookahFromMouth + StareInSilence + AskWhoAreYou + } + + // Alice's confused response + > { + AliceExplainsShesChanged + Caterpillar_StatesDisagreement + AliceExplainsMore + Caterpillar_Contradicts + } + + // Philosophical exchange + ? { + // On change and identity + > { + AliceMentionsDifferentSizes + Caterpillar_DismissesComplaint + AliceSuggestsFutureChange + Caterpillar_ShowsIndifference + } + + // On memory and self + > { + AskWhatAliceCantRemember + AliceRecitesPoem + RecitationIsWrong + CriticizeStrictly + } + } + + // Eventual aid (after sufficient confusion) + > { + AskWhatSizeAliceWants + AliceExplainsPreference + OfferCrypticAdvice + NotSpecifyWhichSide + LeaveAliceToExperiment + } + + // Transformation and departure + > { + CrawlDownMushroom + Vanish + } + } +} + +behavior Caterpillar_MushroomAdvice { + ---description + The Caterpillar's guidance about the size-changing mushroom. + Deliberately vague to force Alice to experiment and learn. + --- + + > { + // Verify Alice's distress about size + > { + ObserveAliceHeight + AskIfContentNow + AliceExplainsDesireToBeNormal + } + + // Offer cryptic instruction + > { + Point AtMushroom + Say + PauseForEffect + Add + } + + // Respond to clarification requests + ? { + > { + AliceAsksWhichSide + Caterpillar_StatesObvious + RefuseToElaborate + } + > { + AliceLooksAtRoundMushroom + RealizesAmbiguity + Caterpillar_AlreadyGone + } + } + + // Let Alice figure it out + > { + CrawlAway + BeginTransformation + LeaveAliceWithPuzzle + } + } +} diff --git a/examples/alice-in-wonderland/world/characters/cheshire_cat.sb b/examples/alice-in-wonderland/world/characters/cheshire_cat.sb new file mode 100644 index 0000000..5843d5f --- /dev/null +++ b/examples/alice-in-wonderland/world/characters/cheshire_cat.sb @@ -0,0 +1,203 @@ +//! Cheshire Cat: The enigmatic guide with a permanent grin + +use schema::core_enums::{Size, EmotionalState, ManifestationLevel}; +use schema::templates::Supernatural; +use schema::beings::Cat; + +character CheshireCat: Cat from Supernatural { + // Physical state + current_size: normal + manifestation: fully_visible + grin_visible: true + + // Personality + emotional_state: amused + follows_logic: false + awareness_of_absurdity: 1.0 + + // Supernatural abilities + can_disappear: true + defies_physics: true + offers_cryptic_advice: true + + // Cat traits + purrs: true + has_claws: true + lands_on_feet: true // Even when vanishing + + ---description + A large cat with a permanent, unsettling grin. Possesses the ability + to appear and disappear at will, often leaving only its grin behind. + Speaks in riddles and offers directions that confuse more than clarify. + + Known for philosophical observations like "We're all mad here" and + "I'm not crazy, my reality is just different than yours." + --- + + ---philosophy + The Cheshire Cat represents the absurdist nature of Wonderland itself. + His ability to vanish piece by piece (usually starting with the tail + and ending with the grin) defies physical law but seems perfectly + natural in Wonderland's logic. + + He tells Alice that everyone in Wonderland is mad, including himself + and her. This is not a judgment but an observation: madness is the + natural state where logic has no power. + --- +} + +behavior CheshireCat_AppearDisappear { + ---description + Complex behavior modeling the Cheshire Cat's gradual materialization + and dematerialization. Uses decorators to add timing and conditions. + --- + + // Root selector: decide action based on current state + ? { + // If invisible, consider appearing + > { + IsInvisible + DecideToAppear + GradualManifestation + } + + // If visible, might give advice or disappear + ? { + // Give cryptic advice + > { + IsFullyVisible + ObserveAliceConfusion + GrinWider + OfferUnhelpfulDirections + } + + // Begin disappearing + > { + IsFullyVisible + DecideToLeave + GradualDematerialization + } + } + + // If partial, continue transition + > { + IsPartiallyManifest + ContinueTransition + } + } +} + +behavior CheshireCat_GradualManifestation { + ---description + Models the piece-by-piece appearance of the Cheshire Cat. + Always ends with the grin appearing last (or first). + --- + + > { + // Start with grin (the signature move) + > { + SetManifestationLevelPartialGrin + WaitTwoSeconds + AliceNoticesGrin + } + + // Eyes appear + > { + AddEyes + SetManifestationLevelPartialBody + WaitOneAndHalfSeconds + } + + // Head materializes around grin + > { + AddHead + WaitOneSecond + } + + // Full body appears + > { + AddBody + AddTail + SetManifestationLevelFullyVisible + GreetAlice + } + } +} + +behavior CheshireCat_GradualDematerialization { + ---description + Models the piece-by-piece disappearance. The grin lingers + "quite some time after the rest of it had gone." + --- + + > { + // Tail vanishes first + > { + FadeTail + WaitOneSecond + } + + // Body fades + > { + FadeBody + SetManifestationLevelPartialBody + WaitOneAndHalfSeconds + } + + // Head disappears, leaving grin + > { + FadeHead + LeaveEyes + SetManifestationLevelPartialGrin + WaitTwoSeconds + AliceRemarksOnGrinWithoutCat + } + + // Finally, grin vanishes + > { + FadeGrin + SetManifestationLevelInvisible + } + } +} + +behavior CheshireCat_OfferAdvice { + ---description + The Cat's advice-giving behavior: cryptic, circular, and often + more confusing than helpful. + --- + + ? { + // If asked for directions + > { + AliceAsksWhichWay + ? { + > { + PointLeft + SayDirections + } + > { + PointRight + SayDirections + } + } + AddPhilosophically + GrinKnowingly + } + + // If asked about the game + > { + AliceAsksAboutCroquet + Say + WaitForResponse + VanishGradually + } + + // General philosophical musing + > { + ObserveAlicesSituation + OfferUnsolicitedWisdom + VanishBeforeExplanation + } + } +} diff --git a/examples/alice-in-wonderland/world/characters/mad_tea_party.sb b/examples/alice-in-wonderland/world/characters/mad_tea_party.sb new file mode 100644 index 0000000..b93315b --- /dev/null +++ b/examples/alice-in-wonderland/world/characters/mad_tea_party.sb @@ -0,0 +1,285 @@ +//! The Mad Tea Party trio: stuck in eternal teatime + +use schema::core_enums::{Size, EmotionalState, TimeState}; +use schema::templates::MadTeaPartyMember; +use schema::beings::{Human, Hare, Dormouse}; + +character MadHatter: Human from MadTeaPartyMember { + // Physical traits + current_size: normal + wears_top_hat: true + hat_size_label: "10/6" // Price tag still attached + + // Personality + emotional_state: confused + follows_logic: false + awareness_of_absurdity: 0.1 // Unaware of his own madness + + // Tea party state + stuck_at_teatime: true + current_seat_position: 1 + riddles_asked: 847 + unanswerable_riddles: 847 // All of them + + // Time relationship + quarreled_with_time: true + murdered_time: true // According to Time + time_frozen_at: 18:00 // 6 o'clock, always + + ---backstory + Once sang at a concert for the Queen of Hearts. Accused of + "murdering the time" for his poor performance of "Twinkle, + twinkle, little bat." As punishment, Time refuses to move + for him - it's always six o'clock, always tea-time. + + Now stuck rotating around a table with the March Hare and + Dormouse, moving to the next seat as dishes get dirty, + asking riddles with no answers. + --- +} + +character MarchHare: Hare from MadTeaPartyMember { + // Physical traits + current_size: normal + whiskers_twitching: true + + // Personality + emotional_state: amused + follows_logic: false + awareness_of_absurdity: 0.05 + + // Tea party state + stuck_at_teatime: true + current_seat_position: 2 + riddles_asked: 723 + + // March madness (breeding season) + madness_level: 1.0 // It's always March for him too + offers_nonexistent_wine: true + + ---backstory + Partner in madness with the Hatter. The March Hare embodies + the saying "mad as a March hare" - the wild behavior of + hares during breeding season. + + Delights in contradiction: offering wine when there's only + tea, claiming things are "the same" when they're opposite, + dipping watches in tea to fix them with "the best butter." + --- +} + +character TheDormouse: Dormouse from MadTeaPartyMember { + // Physical traits + current_size: tiny + currently_sleeping: true + + // Personality + emotional_state: melancholy + follows_logic: true // When awake, which is rare + awareness_of_absurdity: 0.6 + + // Tea party state + stuck_at_teatime: true + current_seat_position: 0 // Between Hatter and March Hare + riddles_asked: 3 + + // Sleep patterns + sleep_cycles_per_hour: 12 + used_as_cushion: true + pinched_to_wake: 15..100 // Times per tea party + + ---backstory + A chronically sleepy dormouse who serves as a cushion + between the Hatter and March Hare. They rest their elbows + on him and talk over his head. + + Occasionally rouses to tell meandering stories about three + sisters living in a treacle well, drawing all manner of + things beginning with M - mousetraps, the moon, memory, + and muchness. + --- + + ---notable_quote + "I breathe when I sleep is the same thing as I sleep when + I breathe!" - said in his sleep, demonstrating the circular + logic of the tea party even while unconscious. + --- +} + +// The eternal tea party schedule - always 6 o'clock +schedule MadTeaPartyRotation { + ---description + Models the endless, circular nature of the Mad Tea Party. + Because time is frozen at 6 o'clock (tea-time), they never + wash dishes - instead they rotate around the table as each + seat's dishes get dirty. + --- + + 18:00 -> 18:01: TeaRound { + ---narrative + Begin a new rotation. All participants have tea, ask + riddles, and engage in nonsensical conversation. + + The Dormouse starts awake, attempts to contribute, + then falls asleep again mid-sentence. + --- + } + + 18:01 -> 18:02: RiddlePhase { + ---narrative + The Hatter asks "Why is a raven like a writing-desk?" + + Alice attempts to solve it. The Hatter admits he doesn't + know the answer. No one knows the answer. There is no + answer. This is the point. + --- + } + + 18:02 -> 18:03: ContradictionPhase { + ---narrative + March Hare contradicts Alice: "You should say what you mean." + Alice: "I do!" + Hatter: "Not the same thing a bit! 'I see what I eat' vs + 'I eat what I see'!" + + The logic spirals into beautiful nonsense. + --- + } + + 18:03 -> 18:04: DormouseStory { + ---narrative + They pinch the Dormouse awake. He tells a drowsy story + about three sisters living in a treacle-well, drawing + treacle, drawing things that begin with M. + + The story makes no sense but continues anyway. + --- + } + + 18:04 -> 18:05: RotateSeats { + ---narrative + "Move down!" The dirty dishes pile up. Everyone shifts + to the next seat clockwise around the table. + + This is their solution to never washing dishes: infinite + table, infinite seats, infinite tea-time. + --- + } + + 18:05 -> 18:00: LoopToBeginning { + ---narrative + Time hasn't moved. It's still 6 o'clock. It's always + 6 o'clock. The party begins again, identical to the last, + identical to the next. + + The Dormouse is asleep. The Hatter checks his broken watch. + The March Hare offers wine that doesn't exist. + + Forever. + --- + } +} + +behavior MadTeaParty_CoordinatedMadness { + ---description + Models the three-way coordination of the Mad Tea Party members. + They interrupt each other, build on each other's nonsense, + and create a cascade of illogic. + --- + + > { + // Initialization: Set up eternal tea time + > { + SetTimeStateFrozen + SetCurrentTimeToSix + VerifyTimeStillSix + } + + // Main party loop (runs forever) + // TODO: Add repeater decorator support + > { + // Selector: Choose a mad activity + ? { + // Riddle sequence + > { + MadHatter_AskRiddle + AliceAttemptsSolution + MadHatter_AdmitsNoAnswer + MarchHare_ChangesSubject + } + + // Contradition game + > { + AliceMakesStatement + MarchHare_ContradictLogic + MadHatter_BuildsOnContradiction + Dormouse_MuttersInSleep + } + + // Story time + > { + PinchDormouse + Dormouse_WakesGroggily + Dormouse_BeginsMeanderingStory + Dormouse_FallsAsleepMidWord + } + + // Butter the watch + > { + MadHatter_ChecksBrokenWatch + MarchHare_OffersButterAsRepair + DipWatchInTea + ExamineWatchHopefully + DeclareItStillBroken + } + + // Seat rotation + > { + DeclareNoRoom + ShiftSeatsClockwise + IncrementSeatPositions + } + } + + // Always end by verifying time hasn't moved + > { + CheckTime + ConfirmStillSixOClock + SighPhilosophically + } + } + } +} + +behavior Dormouse_SleepCycle { + ---description + Models the Dormouse's constant oscillation between sleep + and brief, drowsy wakefulness. Uses a repeater decorator. + --- + + // TODO: Add repeater decorator support + > { + > { + FallAsleep + BeUsedAsCushion + WaitForPinch + } + + > { + WakeWithStart + MutterConfusedly + ? { + > { + BeginStory + DescribeTheirNames + ExplainTreacleWell + FallAsleepMidSentence + } + > { + MakeCircularStatement + CloseEyesAgain + } + } + } + } +} diff --git a/examples/alice-in-wonderland/world/characters/royal_court.sb b/examples/alice-in-wonderland/world/characters/royal_court.sb new file mode 100644 index 0000000..ae670a1 --- /dev/null +++ b/examples/alice-in-wonderland/world/characters/royal_court.sb @@ -0,0 +1,315 @@ +//! The Royal Court of Hearts: tyrannical hierarchy + +use schema::core_enums::{Size, EmotionalState, CardSuit, CardRank}; +use schema::templates::{PlayingCard, CourtMember}; +use schema::beings::PlayingCardPerson; + +character QueenOfHearts: PlayingCardPerson from PlayingCard, CourtMember { + // Card identity + suit: hearts + rank: queen + current_size: normal + fear_of_queen: 0.0 // She IS the Queen + + // Personality + emotional_state: angry + follows_logic: false + awareness_of_absurdity: 0.0 + + // Royal traits + loyalty_to_queen: 1.0 // To herself + times_threatened_with_beheading: 0 // She's the one doing the threatening + survival_instinct: 0.1 // Reckless with her own safety + + // Tyrannical nature + temper: 1.0 + mercy: 0.0 + subjects_beheaded_today: 47 // So far today + off_with_their_heads_count: 347 // Total for today + + // Game preferences + cheats_at_croquet: true + patience_for_rules: 0.0 + + ---description + The terrifying matriarch of Wonderland's Court of Hearts. Quick + to rage, quicker to order executions. Her signature phrase + "Off with their heads!" rings out constantly across the croquet + grounds and palace halls. + + Plays croquet with live flamingos and hedgehogs, cheats brazenly, + and flies into a fury when contradicted or when anyone wins. + --- + + ---psychological_profile + The Queen represents arbitrary authority and irrational rage. + She sees slights everywhere, interprets everything as disrespect, + and her solution to all problems is immediate execution. + + Notably, while she orders constant beheadings, the King quietly + pardons everyone afterward. The Queen never notices this + undermining of her authority. + --- +} + +character KingOfHearts: PlayingCardPerson from PlayingCard, CourtMember { + // Card identity + suit: hearts + rank: king + current_size: small // Shorter than the Queen + fear_of_queen: 0.95 // Terrified but hides it well + + // Personality + emotional_state: frightened + follows_logic: true + awareness_of_absurdity: 0.7 + + // Royal traits + loyalty_to_queen: 1.0 // Out of fear + times_threatened_with_beheading: 156 // Even kings aren't safe + survival_instinct: 1.0 + + // Peacemaking nature + mercy: 1.0 + secretly_pardons_everyone: true + attempts_to_calm_queen: true + + ---description + The meek and mild King of Hearts, thoroughly dominated by + his wife. He attempts to moderate her rage with whispered + pleas like "Consider, my dear: she is only a child!" + + Serves as judge at the trial, but his authority is purely + nominal. Secretly pardons all the Queen's execution orders, + which is how anyone survives in Wonderland. + --- +} + +character CardGardenerTwo: PlayingCardPerson from PlayingCard { + suit: spades + rank: two + current_size: normal + + emotional_state: frightened + fear_of_queen: 1.0 + follows_logic: true + awareness_of_absurdity: 0.8 + + // Gardener traits + currently_painting_roses: true + roses_painted_white_to_red: 247 // About halfway done + mistakes_admitted: 1 // The white rose tree + + ---description + One of three card gardeners (Two, Five, Seven) caught painting + white roses red. They planted a white rose tree by mistake + when the Queen wanted red. Now desperately painting before + she arrives, knowing the penalty is beheading. + --- +} + +character CardGardenerFive: PlayingCardPerson from PlayingCard { + suit: spades + rank: five + current_size: normal + + emotional_state: angry + fear_of_queen: 1.0 + follows_logic: true + awareness_of_absurdity: 0.8 + + currently_painting_roses: true + quick_to_blame_others: true + splashed_by_seven: true + + ---description + The irritable middle gardener who gets splashed with paint + and immediately blames Seven. More concerned with assigning + fault than finishing the job before the Queen arrives. + --- +} + +character CardGardenerSeven: PlayingCardPerson from PlayingCard { + suit: spades + rank: seven + current_size: normal + + emotional_state: angry + fear_of_queen: 1.0 + follows_logic: true + awareness_of_absurdity: 0.8 + + currently_painting_roses: true + accused_of_bringing_tulip_roots: true + elbow_jogged_five: true + + ---description + The gardener blamed for both jogging Five's elbow and for + bringing the cook tulip-roots instead of onions. Accused + of all manner of things, deserves beheading according to + the Queen. + --- +} + +behavior QueenOfHearts_RagePattern { + ---description + Models the Queen's hair-trigger temper and constant execution + orders. Any perceived slight triggers the same response. + + Uses a selector to try different rage escalations, all ending + in "Off with their heads!" + --- + + // TODO: Add repeater decorator support + > { + // Wait for any stimulus + WaitForInteraction + + // Selector: Interpret stimulus as offense + ? { + // Minor perceived slight + > { + DetectMinorIrregularity + TurnCrimson + Glare + Scream + StompFoot + } + + // Someone wins at croquet + > { + ObserveSomeoneScoring + DeclareCheating + Rage + OrderExecution + } + + // Anyone speaks back + > { + HearContradiction + TurnPurpleWithFury + Shriek + TurnToKing + DemandAgreement + } + + // Painted roses discovered + > { + NoticePaintBrushes + DemandExplanation + InterruptExplanation + OrderImmediateBeheading + } + + // Default: random rage + > { + FeelIrrationalAnger + LookForTarget + FindTarget + ScreamOffWithTheirHeads + } + } + + // King attempts to moderate + ? { + > { + King_WhispersPleas + Queen_IgnoresEntirely + } + > { + King_RemindsOfMercy + Queen_GlaresAtKing + ConsiderBeheadingKingToo + } + } + + // Execution order given (but secretly pardoned later) + > { + IncrementBeheadingCount + SoldiersLookUncertain + VictimPleadsOrFlees + } + } +} + +behavior CardGardeners_DesperatePainting { + ---description + Three gardeners frantically painting white roses red before + the Queen discovers their mistake. Models coordinated panic. + --- + + > { + // Initial panic + > { + CheckQueensPosition + EstimateTimeRemaining + PaintFaster + } + + // Coordination breaks down under stress + // TODO: Add repeater decorator support + > { + ? { + // Blame game + > { + Five_GetsSplashed + Five_BlamesS even + Seven_DefendsHimself + Two_AttemptsMediation + AllArgumentInterrupted + } + + // Desperate painting + > { + Two_PaintsRose + Five_PaintsRose + Seven_PaintsRose + } + + // Discovery and panic + > { + HearQueensProcession + Five_Shouts + AllThrowThemselvesFlat + AwaitFate + } + } + } + } +} + +behavior KingOfHearts_SecretPardons { + ---description + The King's quiet subversion of the Queen's execution orders. + Runs in background after each of her rage episodes. + --- + + // TODO: Add repeater decorator support + > { + // Wait for Queen's execution order + WaitForOffWithTheirHeads + + // Let some time pass + WaitThirtySeconds + + // Secretly pardon + ? { + > { + QueenIsDistracted + QuietlyApproachSoldiers + WhisperPardon + SoldiersNodRelief + VictimQuietlyEscapes + } + > { + WritePardonOrder + SlipItToKnave + KnaveDeliversMercy + EveryonePretendExecution Happened + } + } + + // This is how anyone survives in Wonderland + DecrementActualBeheadingCount + } +} diff --git a/examples/alice-in-wonderland/world/characters/white_rabbit.sb b/examples/alice-in-wonderland/world/characters/white_rabbit.sb new file mode 100644 index 0000000..5391460 --- /dev/null +++ b/examples/alice-in-wonderland/world/characters/white_rabbit.sb @@ -0,0 +1,75 @@ +//! White Rabbit: The anxious herald of Wonderland + +use schema::core_enums::{Size, EmotionalState}; +use schema::templates::{WonderlandCreature, CourtMember}; +use schema::beings::Rabbit; + +character WhiteRabbit: Rabbit from WonderlandCreature, CourtMember { + // Physical traits + current_size: small + wears_waistcoat: true + has_pocket_watch: true + + // Personality + emotional_state: frightened + follows_logic: true + awareness_of_absurdity: 0.3 + + // Court relations + loyalty_to_queen: 0.95 + times_threatened_with_beheading: 47 + survival_instinct: 1.0 + + // Time obsession + minutes_late: 2..1000 // Always perceives himself as late + watch_checks_per_hour: 30 + + ---appearance + A white rabbit with pink eyes, dressed in a waistcoat with a + watch-pocket. Constantly glances at his pocket watch while + muttering "Oh dear! Oh dear! I shall be too late!" + --- +} + +behavior WhiteRabbit_ConstantlyLate { + ---description + Models the White Rabbit's perpetual anxiety about time and + his duties to the Queen. Uses a selector to try multiple + panic responses. + --- + + // Top-level selector: try different panic strategies + ? { + // Sequence: Check time, panic, flee + > { + CheckPocketWatch + RealizeHowLate + MutterAnxiously + ScurryToDestination + } + + // Sequence: Encounter obstacle, panic more + > { + EncounterObstacle + DropGloves + DropFan + PanicFurther + ReverseDirection + } + + // Sequence: See Queen, extreme panic + > { + SpotQueen + FlattenEarsInFear + TremblingBow + AwaitCommands + } + + // Fallback: Just keep running + > { + CheckWatch + RunInCircles + CheckWatchAgain + } + } +} diff --git a/examples/alice-in-wonderland/world/institutions/wonderland_institutions.sb b/examples/alice-in-wonderland/world/institutions/wonderland_institutions.sb new file mode 100644 index 0000000..5696881 --- /dev/null +++ b/examples/alice-in-wonderland/world/institutions/wonderland_institutions.sb @@ -0,0 +1,169 @@ +use schema::core_enums::{ + GovernmentType, GovernmentStyle, HierarchyStyle, + Temperament, Power, JudicialPresumption, Sentence, + GatheringType, Purpose, SeatRotation, Enforcement +}; + +institution CourtOfHearts { + type: monarchy + government_style: absolute_tyranny + hierarchy: rigid + rule_of_law: false + + // Leadership + monarch: QueenOfHearts + consort: KingOfHearts + monarch_temperament: volatile + actual_power: queen_only + + // Court composition + soldiers: 10 // Clubs + courtiers: 10 // Diamonds + royal_children: 10 // Hearts + gardeners: 3 // Spades + executioner: 1 // Rarely needed, thanks to King's pardons + + // Judicial system + trial_procedure: "sentence first, verdict afterwards" + presumption: "guilt" + most_common_sentence: "beheading" + actual_executions: 0 // King pardons everyone + + // Cultural norms + bowing_required: true + contradiction_forbidden: true + winning_at_games_forbidden: true // Only Queen may win + + ---description + The tyrannical monarchy ruling Wonderland. Led by the Queen + of Hearts, whose primary form of governance is shouting + "Off with their heads!" at any perceived slight. + + The King serves as a moderating force, quietly pardoning those + the Queen condemns. This creates a strange equilibrium: the Queen + maintains authority through terror, but no one actually dies. + --- + + ---power_structure + Nominal Structure: + Queen (absolute power) + ├─ King (theoretical co-ruler) + ├─ Knave (herald, blamed for tart theft) + ├─ Soldiers (enforcers) + ├─ Courtiers (advisors, sycophants) + └─ Gardeners (groundskeepers) + + Actual Power Flow: + Queen (rage and threats) + └─ King (secret pardons, actual mercy) + + The entire institution runs on the contradiction between + apparent severity and actual leniency. + --- +} + +institution MadTeaParty { + type: eternal_social_gathering + purpose: tea_consumption + stuck_in_time: true + time_frozen_at: 18:00 + + // Members + permanent_members: 3 + temporary_visitors: 0..5 // Like Alice + member_sanity: 0.0 + + // Rules (such as they are) + logic_required: false + personal_remarks: encouraged + riddles_must_have_answers: false + changing_seats_mandatory: true + wine_offering_despite_absence: true + + // Temporal properties + can_wash_dishes: false // No time between teas + solution_to_dirty_dishes: rotation + + ---description + An eternal tea party hosted by the Mad Hatter and March Hare, + with the Dormouse as perpetual cushion. Stuck in a time loop + at 6 o'clock because the Hatter offended Time itself. + + The party follows the logic of madness: riddles have no answers, + wine is offered but doesn't exist, personal remarks are standard, + and when dishes get dirty, they simply move to the next seat + around the infinite table. + --- + + ---social_dynamics + The Hatter and March Hare function as a unit of coordinated + madness, building on each other's nonsense. They speak in + contradictions and circular arguments. + + The Dormouse serves both as furniture (cushion) and occasional + entertainment (drowsy stories). He's simultaneously part of + the institution and subjected to it (pinched, used as pillow, + tea poured on his nose). + + Visitors like Alice are immediately drawn into the madness, + forced to participate in unanswerable riddles and illogical + debates. Escape is possible only by declaring "I'll never come + here again! It's the stupidest tea-party I ever was at!" + --- +} + +institution WonderlandDreamLogic { + type: fundamental_reality_framework + governs: "all of Wonderland" + consistency: none + predictability: zero + + // Physical laws + gravity: negotiable + size: mutable + time: optional + causality: reversed // Effect before cause is common + + // Social laws + hierarchy: based_on_volume // Loudest voice wins + authority: arbitrary + punishment: threatened_constantly_executed_never + madness: mandatory + + // Linguistic laws + words_mean: "what I choose them to mean" + statements: often_self_contradicting + questions: frequently_unanswerable + logic: deliberately_violated + + ---description + The overarching "institution" of Wonderland itself - the dream + logic that governs every interaction and event. This is not an + organization but the fundamental rule system (or lack thereof) + of the world. + + In Wonderland: + - Size changes based on food and drink + - Time can be quarreled with and stopped + - Cats can vanish, leaving only grins + - Tea parties last forever + - Playing cards serve as people + - Executions are ordered but never happen + - Caucus races have no winners (everyone wins) + --- + + ---philosophical_foundation + Wonderland operates on dream logic, which is to say: the logic + of the unconscious mind, where contradictions coexist, authority + is absurd, and rules change moment to moment. + + Alice's attempts to apply normal-world logic fail constantly. + Her lessons in mathematics don't work underground. Her recitation + of poems comes out wrong. Her Victorian manners are useless against + the Queen's rage. + + The only way to survive Wonderland is to either embrace the + madness (like the Hatter) or maintain a core of sanity while + surfing the absurdity (like Alice eventually learns). + --- +} diff --git a/examples/alice-in-wonderland/world/locations/wonderland_places.sb b/examples/alice-in-wonderland/world/locations/wonderland_places.sb new file mode 100644 index 0000000..352e93e --- /dev/null +++ b/examples/alice-in-wonderland/world/locations/wonderland_places.sb @@ -0,0 +1,227 @@ +//! Locations in Wonderland: surreal geography + +use schema::core_enums::TimeState; + +location RabbitHole { + depth: 1000..4000 // Miles deep, or so Alice calculates + falls_like: tunnel + lined_with: ["cupboards", "bookshelves", "maps", "pictures"] + contains_marmalade_jar: true + jar_is_empty: true + + ---description + A deep hole under a hedge, leading straight down like a well. + The fall is impossibly long, giving Alice time to wonder about + geography, talk to herself about Dinah the cat, and examine + the curious furnishings along the walls. + + She falls so slowly (or the hole is so deep) that she has time + to take a jar labeled "ORANGE MARMALADE" from a shelf, discover + it empty, and replace it in a cupboard further down. + --- + + ---physical_properties + Defies normal physics. The fall should be fatal but Alice lands + gently on sticks and dry leaves. The sides are inexplicably + furnished like a house. The depth is impossible. + + This is the threshold between normal world and Wonderland - + logic breaks down in the tunnel itself. + --- +} + +location HallOfDoors { + shape: "long and low" + lit_by: "lamps hanging from roof" + number_of_doors: 20..50 + all_locked: true + + // The tiny door + has_tiny_door: true + tiny_door_height_inches: 15 + tiny_door_leads_to: garden + + // The glass table + has_glass_table: true + table_legs: 3 + golden_key_on_table: true + bottle_appears_spontaneously: true + + ---description + A long, low hall with doors all around. All doors are locked. + Alice tries every one, walking down one side and up the other + in sadness and frustration. + + A three-legged glass table holds a tiny golden key. After much + searching, Alice finds it unlocks a curtain-concealed door only + fifteen inches high. Through it, she glimpses the beautiful + garden she longs to reach. + --- +} + +location Garden { + beauty_level: 1.0 + has_rose_trees: true + roses_should_be: red + roses_actually_are: white // Being hastily painted + has_croquet_ground: true + + // Garden features + has_fountains: true + has_flower_beds: true + desirability_to_alice: 1.0 + + // Transformation site + where_alice_becomes_normal_size: true + + ---description + The lovely garden Alice glimpses through the tiny door. Filled + with bright flowers and cool fountains. Represents normalcy + and beauty in contrast to Wonderland's chaos. + + Contains the Queen's croquet ground, where the beauty quickly + gives way to tyranny and absurdity as flamingos serve as + mallets and hedgehogs as balls. + --- + + ---symbolism + The garden represents Alice's desire for order and sense. + She spends much of the early story trying to reach it, + shrinking and growing to fit through the door. + + When she finally arrives, it's less paradise than she imagined - + the Queen's mad croquet game and constant execution threats + make it as chaotic as everywhere else in Wonderland. + --- +} + +location MadTeaPartyTable { + time_state: frozen + current_time: 18:00 // Always 6 o'clock + size: very_large + seats_occupied: 3 + seats_available: 97..997 + + // Table state + covered_in_dirty_dishes: true + never_washed: true + rotation_direction: clockwise + + // Refreshments + has_tea: true + has_wine: false // Despite March Hare's offers + has_butter: true // For watch repairs + has_bread_knife: true // To spread butter + + ---description + A large table set out under a tree in front of a house. Three + participants (Hatter, March Hare, Dormouse) crowd into one corner + despite abundant space. + + Because Time refuses to move past six o'clock, it's always tea-time. + They never have time to wash dishes, so they rotate around the + table to clean seats as the previous ones get dirty. + --- + + ---temporal_paradox + The table exists in a time loop. The same conversations happen + repeatedly. The same riddles are asked. The same butter is used + on the same watch. + + "Suppose we change the subject" is said eternally, but the subject + never truly changes. The Dormouse tells the same story about the + treacle well forever. + --- +} + +location CroquetGround { + belongs_to: queen_of_hearts + terrain: "all ridges and furrows" + game_in_progress: true + rules_exist: false + + // Live equipment + mallets_are: flamingos + balls_are: hedgehogs + arches_are: card_soldiers + + // Game state + players_play_simultaneously: true + cheating_allowed: true // For Queen only + queen_always_wins: true + + ---description + The Queen's croquet ground, where the game is pure chaos. + Live flamingos serve as mallets but twist around to look at + players. Live hedgehogs serve as balls but unroll and crawl away. + Soldiers bend to form arches but walk off to other parts of the + ground. + + All players play at once without waiting turns, quarreling and + fighting for hedgehogs. The Queen goes stamping about shouting + "Off with their heads!" every minute. + --- + + ---game_theory + The game has no rules, or rather, the only rule is that the + Queen wins. The equipment is deliberately uncooperative. The + terrain is maximally difficult. Victory is impossible. + + This is Wonderland's version of sport: a perfectly designed + system for generating frustration, with arbitrary authority + (the Queen) as the only arbiter. + --- +} + +location QueensPalace { + architectural_style: "playing card" + inhabitants: card_people + staff: ["soldiers", "courtiers", "gardeners", "cooks"] + + // Court features + has_throne_room: true + has_croquet_ground: true + has_kitchens: true // Where Duchess's cook adds too much pepper + + // Justice system + has_courtroom: true + presumption_of_innocence: false + sentence_before_verdict: true // "Sentence first! Verdict afterwards!" + + ---description + The palace of the King and Queen of Hearts. Everything is + decorated with hearts. Inhabitants are all playing cards - + soldiers (clubs), courtiers (diamonds), royalty (hearts). + + The court system operates on Wonderland logic: sentences are + pronounced before verdicts, evidence is nonsensical, and the + Queen shouts for executions regardless of guilt or innocence. + --- +} + +location MushroomTop { + height_above_ground: 4..5 // Feet + diameter: 2..3 // Feet + mushroom_color: white_with_spots + inhabited_by: caterpillar + + // Size-changing properties + one_side_makes_taller: true + other_side_makes_shorter: true + which_is_which: ambiguous // Round mushroom has no clear "sides" + + // Atmosphere + hookah_smoke_present: true + philosophical_discussions: true + + ---description + The top of a large mushroom where the Caterpillar sits smoking + a hookah. About the same height as Alice (when she's normal-sized, + which is rare). + + The mushroom has magical properties: one side makes you grow, + the other makes you shrink. Alice must figure out which is which + through dangerous experimentation, resulting in her neck growing + like a serpent at one point. + --- +} diff --git a/examples/alice-in-wonderland/world/relationships/wonderland_relationships.sb b/examples/alice-in-wonderland/world/relationships/wonderland_relationships.sb new file mode 100644 index 0000000..1063525 --- /dev/null +++ b/examples/alice-in-wonderland/world/relationships/wonderland_relationships.sb @@ -0,0 +1,278 @@ +//! Relationships in Wonderland: connections and dynamics + +use schema::core_enums::EmotionalState; + +// Alice's pursuit of the White Rabbit - what draws her into Wonderland +relationship AliceAndWhiteRabbit { + Alice { + // Alice's perspective + role: pursuer + motivation: curiosity + emotional_investment: 0.7 + understands_other: false + + ---perspective + Alice follows the White Rabbit out of pure curiosity. "How + remarkable!" she thinks when he checks his watch. The Rabbit + represents the mystery of Wonderland - always rushing ahead, + never looking back, leading her deeper into strangeness. + --- + } + + WhiteRabbit { + // White Rabbit's perspective + role: unwitting_guide + motivation: avoid_being_late + emotional_investment: 0.0 + aware_of_alice: false // Too preoccupied + + ---perspective + The White Rabbit barely notices Alice exists. He's consumed + by his own anxiety about being late for the Duchess, then + the Queen. Alice is just another obstacle between him and + punctuality. + --- + } +} + +// Alice and the Cheshire Cat - mysterious guide and confused visitor +relationship AliceAndCheshireCat { + Alice { + // Alice's perspective + role: seeker_of_guidance + emotional_state: confused + trusts_cat: 0.5 // Somewhat unsettling but helpful + + ---perspective + Alice finds the Cat both helpful and disturbing. He offers + directions (though everyone he points to is mad), listens + to her complaints about the croquet game, and provides the + philosophical framework "we're all mad here." + + His disappearing act is unnerving but she's glad to have + someone to talk to who doesn't threaten her with beheading. + --- + } + + CheshireCat { + // Cheshire Cat's perspective + role: amused_observer + emotional_state: amused + helps_because: entertainment + + ---perspective + The Cat finds Alice endlessly entertaining. She's trying + to apply logic to Wonderland, which is inherently funny. + He helps her just enough to keep the show going, offering + directions that aren't wrong but aren't particularly helpful. + + "We're all mad here. I'm mad. You're mad." This is both + warning and welcome. He's inviting her to accept the + absurdity. + --- + } + + bond: 0.6 +} + +// The Mad Hatter and March Hare - partners in madness +relationship HatterAndHare { + MadHatter { + // Hatter's perspective + role: co_conspirator + coordination: 1.0 + builds_on_others_nonsense: true + + ---perspective + The Hatter and March Hare think as one unit of madness. + When one makes a nonsensical statement, the other builds + on it. They finish each other's contradictions. They + coordinate their assaults on logic. + + "You might just as well say 'I see what I eat' is the + same as 'I eat what I see'!" - this kind of parallel + construction shows their synchronized absurdity. + --- + } + + MarchHare { + // March Hare's perspective (same as Hatter's - they're unified) + role: co_conspirator + coordination: 1.0 + builds_on_others_nonsense: true + + ---perspective + From the March Hare's side, it's identical. They're two + halves of the same mad whole. Where one leads in nonsense, + the other follows. Together they create an impenetrable + wall of illogic. + + The Dormouse serves as their shared cushion and occasional + entertainment, but the true relationship is between the + two perpetrators of madness. + --- + } + + bond: 0.95 // Deep partnership +} + +// The Queen and King - tyranny and secret rebellion +relationship QueenAndKing { + QueenOfHearts { + // Queen's perspective + role: dominant_spouse + aware_of_pardons: false // Completely oblivious + expects: total_obedience + + ---perspective + The Queen views the King as a minor annoyance who occasionally + needs to be threatened. She expects him to agree with her + rage, support her execution orders, and generally stay out + of her way. + + She has no idea he undermines every execution order. Her + blindness to his quiet rebellion is the only thing that + keeps the marriage (and Wonderland) functioning. + --- + } + + KingOfHearts { + // King's perspective + role: secret_moderator + loves_queen: 0.3 + fears_queen: 0.9 + subverts_authority: 1.0 + + ---perspective + The King lives in constant fear but maintains his rebellion + through whispered pardons. "Consider, my dear: she is only + a child!" - these timid pleas fall on deaf ears. + + His real power is exercised in secret: pardoning those the + Queen condemns, preventing the executions she orders. He's + the true ruler of Wonderland, governing through mercy while + she rages in impotent fury. + --- + } + + bond: 0.4 // Marriage held together by fear and secret subversion +} + +// Alice and the Caterpillar - student and philosophical teacher +relationship AliceAndCaterpillar { + Alice { + // Alice's perspective + role: confused_student + emotional_state: frustrated + seeking: answers_about_size + + ---perspective + Alice finds the Caterpillar incredibly frustrating. He asks + "Who are YOU?" when she's having an identity crisis. He + contradicts everything she says. He refuses to elaborate + on his cryptic advice about the mushroom. + + Yet he ultimately helps her gain control over her size + changes, providing the knowledge she needs even if his + manner is infuriating. + --- + } + + Caterpillar { + // Caterpillar's perspective + role: socratic_teacher + emotional_state: melancholy + teaching_method: contradiction + + ---perspective + The Caterpillar forces Alice to confront her confusion + through questioning. "Who are YOU?" is not rhetorical - + he's making her face the fact that she doesn't know. + + His advice about the mushroom is deliberately incomplete. + She must experiment, fail, grow too large, shrink too + small, before mastering the technique. This is teaching + through experience, not explanation. + --- + } + + bond: 0.5 +} + +// Card Gardeners - fearful colleagues +relationship GardenersFearfulColleagues { + CardGardenerTwo { + // Two's perspective + role: mediator + tries_to_calm: true + explains_mistake: true + + ---perspective + Two attempts to maintain focus on the task: paint the + roses before the Queen arrives. When Five and Seven argue, + he tries to mediate. When Alice asks questions, he explains + their predicament honestly. + + He's the voice of desperate pragmatism in a hopeless situation. + --- + } + + CardGardenerFive { + // Five's perspective + role: blame_assigner + gets_splashed: true + quick_to_anger: true + + ---perspective + Five is more concerned with who's at fault than with solving + the problem. When paint splashes him, he immediately blames + Seven. This finger-pointing wastes precious time but feels + necessary to his sense of justice. + + His anger is fear displaced - they're all about to be + beheaded, so at least someone should be blamed properly. + --- + } + + bond: 0.6 +} + +// The Dormouse and the Tea Party hosts - cushion and tormentors +relationship DormouseAndHosts { + TheDormouse { + // Dormouse's perspective + role: unwilling_participant + would_rather: sleep + stories_interrupted: always + + ---perspective + The Dormouse just wants to sleep. He's pinched awake, + used as a cushion, has tea poured on his nose, and whenever + he starts a story, he's interrupted or falls asleep mid-sentence. + + His relationship with the Hatter and March Hare is one of + resigned tolerance. They're his tormentors but also his + companions in the eternal tea party. He can't escape, so + he sleeps. + --- + } + + MadHatter { + // Hatter's perspective (and March Hare's - they treat Dormouse identically) + role: user_of_furniture + values_dormouse_as: cushion_and_entertainment + consideration: minimal + + ---perspective + To the Hatter and March Hare, the Dormouse is both furniture + and occasional diversion. They rest their elbows on him + without thinking. They wake him when they want a story, + then ignore him mid-tale. + + There's no malice, just complete disregard for his comfort. + This is how the mad treat the merely sleepy. + --- + } + + bond: 0.4 +}