The Ant and the Cicada

Aesop

The Ant and the Cicada
// The Ant and the Cicada — cinematic code fable

const Summer = Season.of("Summer");
const Winter = Season.of("Winter");

const Tree = Place.of("Tree");
const Anthill = Place.of("Anthill");

const Ant = Insect.of("Ant")
   .liveAt(Anthill);
const Cicada = Insect.of("Cicada")
   .sitOn(Tree.branch());

Summer.begin();

while (Summer.active()) {
  Ant.work()
     .carry(grain)
     .store(food);

  Cicada.sing()
     .play()
     .rest();

  if (Ant.passBy(Tree) && Cicada.notice(Ant)) {
    Cicada.laugh()
       .say("Why work so hard on such a beautiful day?")
       .say("Come sing with me!");

    Ant.stop()
       .adjustLoad()
       .say("I prepare for winter.")
       .say("Cold days always come.");

    Cicada.waveWing()
       .say("Winter is far away.")
       .say("Today is for joy.");

    Ant.walkOn();
  }
}

Summer.end();
Winter.begin();

Cicada.silent()
   .shiver()
   .wander()
   .see(Ant.home({ warm: true, full: true }));

Cicada.knock(Anthill)
   .voice("weak")
   .say("Ant, please help me.")
   .say("I am cold and hungry.")
   .say("I did not know winter would be so cruel.");

Ant.openDoor()
   .lookAt(Cicada)
   .sad()
   .say("You sang all summer while I worked.")
   .pause(1)
   .say("Now you must face the result of that choice.")
   .closeDoor();

Cicada.lowerHead()
   .understand();

Winter.continue();