2026-02-13 21:52:03 +00:00
|
|
|
//! Template definitions for the Baker family
|
|
|
|
|
//!
|
2026-02-14 14:45:17 +00:00
|
|
|
//! This example demonstrates v0.3.0 features:
|
|
|
|
|
//! - Species-based template inheritance (template Name: Species)
|
2026-02-13 21:52:03 +00:00
|
|
|
//! - Resource linking (uses_behaviors, uses_schedule)
|
2026-02-14 14:45:17 +00:00
|
|
|
//! - Template inheritance with include
|
2026-02-13 21:52:03 +00:00
|
|
|
//! - Multi-level template hierarchies
|
|
|
|
|
|
2026-02-14 14:45:17 +00:00
|
|
|
// Base template for all persons, inheriting from Human species
|
|
|
|
|
template Person: Human {
|
2026-02-13 21:52:03 +00:00
|
|
|
uses behaviors: BasicNeeds, SocialInteraction
|
|
|
|
|
age: 0..100
|
|
|
|
|
energy: 0.0..1.0
|
|
|
|
|
mood: 0.0..1.0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Worker template extends Person
|
|
|
|
|
template Worker {
|
|
|
|
|
include Person
|
|
|
|
|
uses schedule: WorkWeek
|
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).
2026-02-23 21:51:01 +00:00
|
|
|
occupation: Laborer
|
2026-02-13 21:52:03 +00:00
|
|
|
work_ethic: 0.5..1.0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Specialized baker template
|
|
|
|
|
template Baker {
|
|
|
|
|
include Worker
|
|
|
|
|
uses behaviors: BakingSkills, CustomerService
|
|
|
|
|
uses schedule: BakerSchedule
|
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).
2026-02-23 21:51:01 +00:00
|
|
|
specialty: Bread
|
2026-02-13 21:52:03 +00:00
|
|
|
baking_skill: 0.0..1.0
|
|
|
|
|
customer_relations: 0.5..1.0
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-14 14:45:17 +00:00
|
|
|
// Child template (no work schedule), also inherits from Human species
|
|
|
|
|
template Child: Human {
|
2026-02-13 21:52:03 +00:00
|
|
|
include Person
|
|
|
|
|
uses behaviors: PlayBehavior, LearnBehavior
|
|
|
|
|
school_grade: 1..12
|
|
|
|
|
curiosity: 0.0..1.0
|
|
|
|
|
}
|