feat(examples): rewrite baker-family as coherent Competition Week narrative

Rewrote the baker-family example around a unified story: the annual Harvest
Baking Competition is Saturday. Martha's sourdough starter Old Maggie is
sluggish from a cold snap, Jane is secretly entering the FreeStyle category,
Emma's science fair project is "The Chemistry of Fermentation", Henry is
judging for the first time and worried about impartiality, and Roland is
defending last year's title.

The week's schedules (Mon guild meeting → Tue test bakes → Wed sourcing →
Thu dough prep → Fri science fair → Sat competition → Sun recovery) are
now fully populated with narrative-specific actions.

Files split for composability:
- behaviors/baker_behaviors.sb → 5 focused files by character/domain
- schema/types.sb → 4 files (core, baking, world, social)
- schedules/work_schedules.sb → 4 files (one per schedule)
- relationships/baker_family_relationships.sb → family + bakery

Strong typing: replaced all enumerable string fields with concepts
(BakerSpecialty, Occupation, LocationType, InstitutionType, ParentingStyle,
Intensity, BakeryDomain, BakingDiscipline, ManagementDomain,
CompetitiveAdvantage).

Remove new-syntax-demo.sb (superseded by baker-family example).
This commit is contained in:
2026-02-23 21:51:01 +00:00
parent 1fa90aff0e
commit abd54e4c33
29 changed files with 820 additions and 587 deletions

View File

@@ -0,0 +1,86 @@
//! Baking types — products, specialties, skills, and craft domains
//!
//! The type vocabulary for everything that happens in the bakery.
// Bakery product categories
concept BakedGood
sub_concept BakedGood.Category {
Bread,
Pastry,
Cake
}
sub_concept BakedGood.Quality { freshness: 1.0, taste: 0.8 }
// Competition categories for the Harvest Baking Competition
sub_concept BakedGood.CompetitionCategory {
Signature,
FreeStyle,
Traditional
}
// Baker specialties
concept BakerSpecialty
sub_concept BakerSpecialty.Type {
Sourdough,
Pastries,
RyeBread,
Bread,
Artisan,
Learning
}
// Skill levels
concept SkillLevel
sub_concept SkillLevel.Tier {
Apprentice,
Journeyman,
Master
}
// Definition - compile-time mapping of skill tiers to quality expectations
// An Apprentice can produce any quality; a Master must produce fresh goods
definition SkillLevel {
Apprentice: {
baking_skill: Tier is Apprentice,
freshness: any
},
Journeyman: {
baking_skill: Tier is Journeyman,
freshness: any
},
Master: {
baking_skill: Tier is Master,
freshness: Tier is Master
}
}
// Baking disciplines (what bakers teach and learn)
concept BakingDiscipline
sub_concept BakingDiscipline.Area {
BakingFundamentals,
PastryDecoration,
BakingScience,
ArtisticExpression
}
// Bakery domain (areas of responsibility)
concept BakeryDomain
sub_concept BakeryDomain.Focus {
BusinessAndBread,
PastriesAndCakes,
PastriesAndPresentation
}
// Management domains
concept ManagementDomain
sub_concept ManagementDomain.Area {
OperationsAndSuppliers,
MenuDesignAndDisplays
}

View File

@@ -0,0 +1,32 @@
//! Core types — the Human species and universal concepts
//!
//! These are the foundational types used by all templates and characters.
// Species definition - provides default fields for all humans
species Human {
age: 0
energy: 0.5
mood: 0.5
occupation: "unemployed"
}
// Occupations
concept Occupation
sub_concept Occupation.Role {
Unemployed,
Laborer,
MasterBaker,
PastryChef,
Baker,
RetiredTeacher
}
// Intensity levels (used for work intensity, service priority)
concept Intensity
sub_concept Intensity.Level {
Low,
Medium,
High
}

View File

@@ -8,21 +8,21 @@
life_arc BakerCareer requires { baking_skill: Number, work_ethic: Number } {
state apprentice {
on enter {
specialty: "learning"
specialty: Learning
}
on baking_skill > 0.5 and work_ethic > 0.7 -> journeyman
}
state journeyman {
on enter {
specialty: "bread"
specialty: Bread
}
on baking_skill > 0.8 and work_ethic > 0.9 -> master
}
state master {
on enter {
specialty: "artisan"
specialty: Artisan
}
}
}

View File

@@ -0,0 +1,17 @@
//! Social types — relationship and competition vocabulary
// Parenting styles
concept ParentingStyle
sub_concept ParentingStyle.Type {
Encouraging,
Creative
}
// Competitive advantage (used in rivalry relationships)
concept CompetitiveAdvantage
sub_concept CompetitiveAdvantage.Type {
CustomerLoyalty,
LowerPrices
}

View File

@@ -18,7 +18,7 @@ template Person: Human {
template Worker {
include Person
uses schedule: WorkWeek
occupation: "laborer"
occupation: Laborer
work_ethic: 0.5..1.0
}
@@ -27,7 +27,7 @@ template Baker {
include Worker
uses behaviors: BakingSkills, CustomerService
uses schedule: BakerSchedule
specialty: "bread"
specialty: Bread
baking_skill: 0.0..1.0
customer_relations: 0.5..1.0
}

View File

@@ -1,51 +0,0 @@
//! Type system definitions for the Baker family
//!
//! Demonstrates v0.3.0 type system features:
//! - Species definitions with default fields
//! - Concepts and sub-concepts with dot notation
//! - Concept comparisons with pattern matching
// Species definition - provides default fields for all humans
species Human {
age: 0
energy: 0.5
mood: 0.5
occupation: "unemployed"
}
// Bakery product types
concept BakedGood
sub_concept BakedGood.Category {
Bread,
Pastry,
Cake
}
sub_concept BakedGood.Quality { freshness: 1.0, taste: 0.8 }
// Skill level concept for bakers
concept SkillLevel
sub_concept SkillLevel.Tier {
Apprentice,
Journeyman,
Master
}
// Definition - compile-time mapping of skill tiers to quality expectations
// An Apprentice can produce any quality; a Master must produce fresh goods
definition SkillLevel {
Apprentice: {
baking_skill: Tier is Apprentice,
freshness: any
},
Journeyman: {
baking_skill: Tier is Journeyman,
freshness: any
},
Master: {
baking_skill: Tier is Master,
freshness: Tier is Master
}
}

View File

@@ -0,0 +1,28 @@
//! World types — the physical and institutional landscape
// Weather conditions (affects sourdough starters like Old Maggie)
concept WeatherCondition
sub_concept WeatherCondition.Type {
ColdSnap,
Mild,
Warm,
Hot
}
// Location types
concept LocationType
sub_concept LocationType.Kind {
Shop,
Road,
PublicBuilding,
School
}
// Institution types
concept InstitutionType
sub_concept InstitutionType.Kind {
TradeGuild
}