The Tortoise and the Hare

Aesop

The Tortoise and the Hare
// 🐢🐇 The Tortoise and the Hare — cinematic code fable

const Track = Place.of("RaceTrack");
const Finish = Track.point("finish");
const Tree = Place.of("Tree");

const Tortoise = Animal.of("Tortoise");
const Hare = Animal.of("Hare");

const Race = Event.of("Race")
   .startAt("morning")
   .endAt(Finish);

Race.begin();

Hare.smirk()
   .say("Easy win.")
   .waveTo(Crowd);

Tortoise.decide("start");
Hare.decide("start");

while (Race.active()) {
  Tortoise.walkSlowly()
     .step()
     .continue();

  Hare.runFast()
     .gainDistance()
     .lookBack();

  if (Hare.feel("confident")) {
    Hare.stop()
       .lookBack()
       .distanceTo(Tortoise)
       .think("I am far ahead.")
       .smirk()
       .say("Why hurry?")
       .lieDown(Tree.shade)
       .rest()
       .laugh()
       .sleep();
  }

  if (Hare.sleeping()) {
    Tortoise.pass(Hare)
       .whisper("step by step");
  }
}

Race.end();

Crowd.holdBreath();

if (Tortoise.reach(Finish) && !Hare.reach(Finish)) {
  Tortoise.win();
}

Hare.wakeUp()
   .run()
   .realize("too late");

Tortoise.standAt(Finish)
   .silent();

Crowd.observe()
     .understand();