philosophers-demo.sleela
lib/philosophers/philosophers-demo.sleela · 96 line(s) · sleela
<< lib/philosophers/philosophers-demo.sleela
SLeeLa runnable demo for the philosophers package.
Definition: builds the canonical chain Constructor() :: Patch :: Constructor
:: Aim :: Guide, weighs favor on the Notice of Approach, runs a time-bounded
contract, and lets the object live free. >>
#sleela 2.5
material;
<< Family: philosophers. A worker-class runnable that exercises the perfect
Constructor end to end and prints its quality, effect and output. It seats
four Guides -- Patch, Constructor, Aim, Guide -- as the user's example asks,
admits a small seating band, provides the facts/sayings of Approach as
imparts, and shows the chain text, the color manifest, the favor verdict, the
two-minute contract clock, and the final "lives free" state. >>
class PhilosophersDemo {
< ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
<< Worker-class baseline identity: an honest record for a single-purpose
runnable example. >>
String metaVersion = "1.0.0";
int metaId = 11570;
String metaAuthor = "Kiro Agent";
String metaDate = "2026-10-24";
String metaCopyright = "SLeeLa project";
String metaTrademark = "none";
String metaCorporation = "none";
String metaOrigin = "International";
String metaBirthDate = "2026-10-24";
int metaScienceRating = 6;
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; }
void main() {
print("=== Philosophers: the perfect Constructor and its Guides ===");
SLPhilosopherConstructor ctor = new SLPhilosopherConstructor();
ctor.create();
< admit a small positive band of additional seatings (in [-2,+6]) >
int band = ctor.admit(3);
print("admitted seating band: " + band + " capacity: " + ctor.capacity());
<< Seat four Guides of the IQ-201+ register, each on its baseline seating
ordinal (see SLPhilosopherSeating): Patch=3 (Inception), Seed=4
(Inception), Aim=6 (Intent), Guide=12 (Governance). Patch, Aim and Guide
carry approving favor (Gold/Yellow); Seed is still growing (Green). >>
ctor.guide("Patch", 3, true);
ctor.guide("Seed", 4, false);
ctor.guide("Aim", 6, true);
ctor.guide("Guide", 12, true);
print("declared chain: " + ctor.chainText());
print("color manifest: " + ctor.colorManifest());
<< Read the orthogonal Ordain axis over the register: Ordain is not a seat,
it is the ordinality that ranks each seating and measures its nearness to
the ordaining crown (Approval, ordinal 20). >>
SLOrdain ordain = new SLOrdain();
ordain.create();
print("ordain(Aim): " + ordain.reading(6));
print("ordain(Guide): " + ordain.reading(12));
print("ordain(crown): " + ordain.reading(20));
< require at least two caught Notices before favor is granted >
ctor.requireNotice(2);
< the facts/sayings of Approach, as imparts broadcast to the Guides >
<< imparts[0..2] name seated Guides (Patch, Aim, Guide) and are matched;
imparts[3] "Approach" is heard but seats no named Guide. >>
String[] imparts = new String[4];
imparts[0] = "Patch";
imparts[1] = "Aim";
imparts[2] = "Guide";
imparts[3] = "Approach";
< run the instantiative moment for 90 seconds (within the ~2-minute bound) >
boolean alive = ctor.run(imparts, 90);
print("verdict: " + ctor.verdict());
print("constructed & lives free: " + alive);
print("report: " + ctor.report());
if (alive) {
print("the object now lives free of its instantiative moment.");
} else {
print("favor was withheld; the construction did not run.");
}
print("done");
}
}