The STEMpunk Project: The Emperor’s Garden

Bai hopped from one foot to the other, a ritual she used to awaken her calves and ankles. Even as she rubbed sleep from her eyes she buzzed with the flare of nervous energy that marks the start of an exciting new journey.

Here, in the gate at the entrance of the Emperor’s garden, was a stunning view of the dawn breaking over the mist-crowned mountaintops on the horizon. The first rays of daylight lanced between the peaks, bathing the world below in their red glow. A great arch bent over her slender, bouncing frame, the advancing army of the sun imbuing the calligraphy with a fire that seemed to come from within.

But Bai saw none of this, because she was focused on only one thing: running. She was lithe, graceful, and fast, and was chosen on the basis of these qualities for one of the most important jobs anyone could have.

She was a novice runner for the Emperor, charged with carrying his cryptic spells from one end of the garden to the other, passing through a number of stages along the way. At least, that was her understanding, built up over years of stories told by her teachers and family members.

“Are you ready”, a voice asked from behind her. She turned and saw an older version of herself, almond-eyed, thin, and black-haired.

“Y-yes”, Bai replied nervously. Her attempt at a smile died on her face at the sight of the other’s stern and unchanging expression.

“Good. You are a runner,” the older girl said, her chin rising as she emphasized the last word. “You are a novice, but the agents in the other abstraction layers are not. You are to give them this —“ she held out an unbound scroll “and though they may speak to you, you are to say nothing. Your job is to be fast. Not curious, not clever.”

Bai’s stomach fluttered at this small rebuke, but she steeled herself and stood as tall and straight as she could. After a moment’s pause she realized that the older girl wasn’t going to move, so she took two quick steps forward and gently grabbed the scroll. Her brow furrowed at its message:

for (var i = 0; i < 10; i++){
return (i * 2);
}

“Do not concern yourself with its contents. Take it, and run”, the older girl said. After another pause Bai realized she meant now. With a nod she turned, and ran.

***

Bai’s long gait, honed over years of practice, carried her across the first stage of the garden in a matter of seconds. The words “abstraction layer” floated back into her mind as she approached the heavy wooden doors on the other wall, but she had no time to ponder their meaning. Just as she was slowing down to open the doors herself, they began creaking apart of their own accord, and she plunged into the dimly lit room beyond them.

This chamber was long and broad, its walls lined with waist-high troughs filled so full of golden tokens that they were spilling onto the floor. Barrels spaced intermittently throughout were also filled with tokens, as were a number of smallish crates clustered around a table near the far side of the room.

Behind that table stood a sagely looking man with a long, pointed white beard. As he watched her approaching one corner of his mouth crept up like a caterpillar raising its head to grasp at the next branch up. He was smiling at Bai the novice runner.

She had barely even slowed down when she made it to the table, arms stretched out in front of her to act as brakes. Having successfully counteracted her own inertia, her hand flicked like a frog’s tongue to her pocket to retrieve the scroll, and she slammed it open on the table with more force than she’d intended.

The sage bowed his head slightly and said, “Hello Bai. I am the tokenizer”, as he reached unhurriedly for the scroll. His eyes didn’t move as he took in the glyphs written on it. After a moment the scroll was back on the table in front of Bai and the sage was shuffling away.

Though Bai could not even begin to decipher the scrolls meaning it must not have been very complicated, because the tokenizer found what he needed in one of the crates nearest to his table. He returned to his place and spread a fistful of tokens on the table before reaching into his pocket for a length of string with a bead at one end.

Now that she was closer Bai could see that each token contained a glyph, such as ‘)’, ‘for’, and ‘=’, as well as a small hole in its center. She couldn’t be sure, but she had a suspicion that each token corresponded to a symbol from the scroll.

As if reading her mind, the sage confirmed her hunch while he slid one token at a time onto the string. “Before the Emperor’s spell can be fully processed and acted upon, I must tokenize it”. He paused while he added two more of the little golden disks. “Each token represents a single language primitive within the spell, and together they form a stream that contains the entire message”. With that he slid the last token into place and held the result up in front of her for inspection. There was perhaps half the string remaining free. “Now take this, Bai the novice runner, into the next room”.

***

As before the doors opened when Bai approached them. But this time she found herself in a much smaller room, within which an elderly woman was raking a a patch of sand as blue as powdered sky. Not having a table to stop against this time, Bai slowed down to a trot before she reached the center of the room.

The woman saw Bai approach, and held out her hand to accept the string, now heavy with tokens. She turned to face an assortment of pots of varying sizes and grabbed a small one.

As Bai watched the woman filled the pot half full of sand, gently placed the token string within, and then finished by burying the string. She patted the top of the sand until it sat firm in the pot, then kneeled, placing it between herself and Bai. Instead of rising the woman sat, legs crossed, and gazed at the pot without blinking. Unsure of what else to do, Bai did the same.

The two women, young and old, sat wordlessly, with the occasional hissing of the torches the only source of sound. Just as Bai was was beginning to become uncomfortable with the silence she saw a tiny branch poke up through the sand.

Over the course of perhaps ten breaths a tree grew in the little pot. It looked like the bonsai she remembered seeing at the temples near her village home, but yellow nodes along its sky blue trunk and branches contained the same glyphs Bai had seen on the tokens given to her in the last room.

The woman stood. “From the language tokens grows a parse tree”, she said as she held the pot out for Bai to take. Bai tried not to let her confusion show as she took the pot with both hands.

***

Bai’s journey continued in this fashion, brief sprints punctuated by longer spans of time in which mysterious people did mysterious things in mysterious rooms. After the chamber with the blue sand Bai watched two men, perhaps only a little older than she was, take the parse tree and use it to make a stack of clay tablets.

They told her that they were the virtual machine implementation, though she knew not what this meant, and as they worked she noticed that the symbols on the top tablet were different than the symbols on either the tokens or the parse tree:

mov ECX,10

Neither of the two men commented on the puzzled expression she wore as she watched them work.

***

Running with the tablets tucked under her arm was difficult, and she wondered how it was that runners dealt with larger spells. Perhaps the runners work in teams, she mused, or maybe the symbols are written in smaller letters on smaller tablets.

The tablet stack she gave to another sagely looking man, this one younger than the first one, with a shorter beard that wasn’t yet completely white. Spreading them out carefully on the floor in front of him he sat, pondering. He began putting yet another set of symbols onto a fresh scroll, but he did so using only two tools: one ink stamp with an unlit torch, one ink stamp with a lit torch.

It was obvious that there was a pattern to the man’s choice in torches. He would gaze at one tablet and then press a long series of torches onto the scroll. Sometimes he would alternate lit torches with unlit torches. Sometimes he would use a long series of either lit or unlit torches in a row.

This layer took longer than all the others combined, though the man worked deftly and with confidence. He glanced up at her from time to time, and she stifled the urge to grin at him in a nervous bid for approval.

“You may advance into the last room,” he said at last, “and give this scroll to the ones that wait within.”

***

Bai was breathless when she burst into the final chamber, as the corridor between this one and the last was much longer than the others. She soon saw why.

The room was lined, from floor to ceiling, with abacuses. Some were very long and thin, others much taller than she was and made up of dozens of rows of colored beads. Throughout were monks in white robes standing on buckets and ladders, on their knees or sitting cross-legged, manipulating beads with their hands, with styluses, with long canes. It was breathtaking, the place buzzed like a hive.

Much like most of the other layers there was a table nearer to the entrance staffed by a person, but this time that person was no more than a boy. He wore nothing above the waist but an impish grin, and wielded an extremely sharp knife as he cut scrolls into smaller shred of paper. She handed him the scroll with the alternating series of torches, and he sat to work cutting it up.

“A certain combination of lit and unlit torches tells me where I’m supposed to cut everything,” he said in response to the question hanging in the air. “Then, based on other combinations of torches I know where to send each scrap”. He carefully shuffled the little pile of scroll scraps into a specific order and then handed them off to several other runners waiting behind him. The last scroll he gave to Bai. “This goes to that memory bank near the back”, he said, pointing. “No need to rush. Take your time and observe everything”.

And she did, though it made no sense to her. When the monks in front of an abacus received a piece of scroll, her scroll, they immediately set to work, mostly in silence. Occasionally a monk would mark a series of torches on their own scrolls and send them to a different part of the room, waiting until a reply came.

This went on for several minutes, until at last someone at the far end of the chamber beckoned her to approach. When she got within arms length he held out a final scroll for her to take. “Your running has been to produce this”, he said. “The Emperor’s Garden is a vast logical machine designed to take spells in one end, do what they instruct, and produce different spells on the other.” He paused while she pondered. “Now, Bai the novice runner, you must take this spell, and go through the process again, in reverse. Exit this layer of The Emperor’s Garden and you shall find another set of abstraction layers. Do in them what you have done here, and”, he stopped as a smile broken open on his face, “be quick about it”.