CharacterDemo.sleela
lib/character/seem/CharacterDemo.sleela · 106 line(s) · sleela
#sleela 2.5
material;
<< lib/character/seem/CharacterDemo.sleela
SLeeLa Standard Library โ runnable orchestration example.
Definition: Casts three Characters, hands each a different BusinessModel, and
runs a quarter of business. It shows the whole point of the package: one
Character class composing many business-model classes through a single
base-typed reference, each answering the same question โ did we make money?
โ with entirely different math.
The authoritative definitions (Character, BusinessModel, and the twelve
concrete business-model subclasses) live one level up in lib/character/*.sleela.
Family: character. >>
class CharacterDemo {
< ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
<< Baseline identity record for a worker-class example unit. Values are
faithful to the subject's real origin where publicly known. >>
String metaVersion = "2.5.0";
int metaId = 11602;
String metaAuthor = "Max Rupplin vs. Dr. Mrs. Elisabeth Harkins";
String metaDate = "2026-10-28";
String metaCopyright = "SLeeLa project";
String metaTrademark = "none";
String metaCorporation = "none";
< metaOrigin: National | <nation> | International | Galactic >
String metaOrigin = "International";
String metaBirthDate = "2026-10-11";
< metaScienceRating: maturity/robustness on a 1..10 scale >
int metaScienceRating = 9;
< metaNationalSchedule: a real, citable instrument or "none" >
String metaNationalSchedule = "none";
String getMetaVersion() { return metaVersion; }
void setMetaVersion(String v) { metaVersion = v; }
int getMetaId() { return metaId; }
void setMetaId(int v) { metaId = v; }
String getAuthor() { return metaAuthor; }
void setAuthor(String v) { metaAuthor = v; }
String getDate() { return metaDate; }
void setDate(String v) { metaDate = v; }
String getCopyright() { return metaCopyright; }
void setCopyright(String v) { metaCopyright = v; }
String getTrademark() { return metaTrademark; }
void setTrademark(String v) { metaTrademark = v; }
String getCorporation() { return metaCorporation; }
void setCorporation(String v) { metaCorporation = v; }
String getOrigin() { return metaOrigin; }
void setOrigin(String v) { metaOrigin = v; }
String getBirthDate() { return metaBirthDate; }
void setBirthDate(String v) { metaBirthDate = v; }
int getScienceRating() { return metaScienceRating; }
void setScienceRating(int v) { metaScienceRating = v; }
String getNationalSchedule() { return metaNationalSchedule; }
void setNationalSchedule(String v) { metaNationalSchedule = v; }
void main() {
< --- Character 1: a SaaS founder with two tiers of seats. --- >
SaaSModel saas = new SaaSModel();
< setUp args: basic, premium, basicPrice, premiumPrice, infraPerSeat (cents) >
saas.setUp(800, 200, 2000, 8000, 400);
Character ada = new Character();
ada.load();
ada.introduce("Ada", "Seats for everyone, dashboards for days.", 70, 500000);
ada.adopt(saas);
print("[saas] " + saas.describe());
< --- Character 2: a marketplace broker taking a cut of every deal. --- >
MarketplaceModel market = new MarketplaceModel();
< setUp args: txns, avgOrder, takeRate%, opCost (cents) >
market.setUp(10000, 4500, 12, 50);
Character max = new Character();
max.load();
max.introduce("Max", "We don't make it, we match it.", 60, 300000);
max.adopt(market);
print("[market] " + market.describe());
< --- Character 3: a manufacturer fighting a big fixed plant cost. --- >
ManufacturingModel plant = new ManufacturingModel();
< setUp args: produced, wholesalePrice, variableCost, fixedPlant (cents) >
plant.setUp(5000, 3000, 1800, 4000000);
Character mae = new Character();
mae.load();
mae.introduce("Mae", "If it isn't bolted down, we made the bolt.", 85, 1000000);
mae.adopt(plant);
print("[plant] " + plant.describe());
print("[plant] break-even units = " + plant.breakEvenUnits());
< --- Run one quarter (3 months) for each Character. --- >
int adaQ = ada.runMonths(3);
int maxQ = max.runMonths(3);
int maeQ = mae.runMonths(3);
print("[quarter] Ada profit=" + adaQ + "; " + ada.describe());
print("[quarter] Max profit=" + maxQ + "; " + max.describe());
print("[quarter] Mae profit=" + maeQ + "; " + mae.describe());
< --- The headline the whole package exists to print. --- >
print("[verdict] Ada thriving? " + ada.thriving()
+ " | Max thriving? " + max.thriving()
+ " | Mae still standing? " + mae.stillStanding());
}
}