Computational Classnotes

How Pyon reads a story

Pyon 1.0a1 · five stories played in the CCN Cloud, with every key explained

By Dara O Shayda and Hikari Noor Hoshino (星野ヌール)
AI System Programming Laboratory, Computational Classnotes · 2 December 2026

The web companion of the paper Pyon: a picture language for children in which a line is a product (paper/pyon-paper.pdf, December 2026, DOI 10.13140/RG.2.2.22314.25287). The paper has the algebra, the phone screens, the safety design and the references; this page has the same stories and the same code, read key by key. The two agree.

Pyon (ぴょん) is a picture language for children. A child writes a story by pressing keys. Each key is a picture: a jump, a nap, an arrow, a lamp, a number. The story is played by two friends, Mochi (もち), a soft round rice cake, and Onigiri (おにぎり), a rice ball in a seaweed coat, both with cat ears, on a stage or on a square grid. The language has no words to spell and no punctuation to learn beyond the end of a line. Yet it has the three ideas on which every programming language rests:

When ▶ is pressed, the page does not play the keys itself. It sends the story to PyonKernel, Pyon’s reader in the CCN Cloud, at https://www.wolframcloud.com/obj/ccn/PyonKernel. PyonKernel reads the story and returns it as JSON in two parts:

  1. lines: how it understood each line: who acts, which numbers and lamps it found, what each lamp read, and how many times the line is to be done.
  2. steps: every move to be played, in order, with where both friends stand after it.

The page then plays the steps, one by one. PyonKernel stores nothing, writes nothing and keeps nothing about the child. If the CCN Cloud does not answer, the page reads the story itself by the same rules, so that Pyon plays offline.

This document reads five stories key by key, then opens the kernel itself: its design and the code that gives each answer. All five were sent to the live kernel (PyonKernel 2026-12-02 02:40, release Pyon 1.0a1) on 2 December 2026 between 05:40 and 05:59 UTC, exactly as the page sends them. Every answer below is quoted as the CCN Cloud returned it. Each answer was then checked independently by replaying the story from the rules of the user guide alone (see the Notes).


The language in five pieces

Every story uses the same few pieces. They are listed with their pictures in docs/legend.md, and explained for parents in docs/user-guide.md, §4.

Written Read as What it does
⚑ … ; “a story, line by line” ⚑ marks the start of the story. Each line ends with ;. A line is read left to right: who acts, then lamps and numbers, then moves.
MochiOnigiriboth
Mochi, Onigiri, both
“who acts” the one who does this line and the lines after it, until another who. A story that names no one is Mochi’s.
×2×3×0
×2, ×3, 0
“two times”, “three times”, “never” a number multiplies the whole line. Numbers together multiply (×2 ×3 is six times); at most nine. Zero makes the line vanish.
nearwallhomefarmiddleawaydice
💡near, 💡wall, 💡home, 🌑…, 🎲
“a lamp”, “a dark lamp”, “the dice” a lamp is a number that looks at the stage when the line’s turn comes: 1 when lit, 0 when dark. near: the friends side by side or on one square. wall: the one acting stands at a wall. home: the one acting stands where it began. A dark lamp 🌑 is the opposite, 1 − c. The dice 🎲 is 1 or 0 by chance.
again
🔁
“again” the line is done again and again while its lamps and dice read 1, read anew before every round; at most nine rounds, or the number in the line. Its key is a loop arrow around a lit bulb.

One rule runs through all of them: a line is done (numbers × dice × lamps) times. Every number, die and lamp is a factor of one product. There is no if in Pyon beyond this: a factor of 0 is the only way to make a line not happen. Again is the same product, read again before every round.

The algebra (paper, §2.3–2.4). Lines joined by “then” form a monoid: joining is associative, the empty line is its identity, and order matters. The numbers act on it as powers: 0·x is the empty line, (m + n)·x = m·x + n·x, and m·(n·x) = (mn)·x. In Kozen’s Kleene algebra with tests, a lamp is a test b, the dark lamp is its complement b̄, and the pair of lines “ℓ x; (1 − ℓ) y” is bx + b̄y. Again is the guarded loop (bx)*b̄, cut off at nine rounds, so that every story ends. If the loop reaches the ceiling with its lamps still lit, the one acting is dizzy.

The square. When a story has arrows, the stage is a 6 × 6 grid of squares (0, 0) to (5, 5), counted from the bottom left. Mochi begins at (1, 1) and Onigiri at (4, 1); those are their home squares. Each arrow moves the one acting one square; at a wall it squishes and stays.

The two boxes. In each example below:

  1. What the page sent is the story, as code points. Pyon’s keys have their own code points, in a block of the Unicode Private Use Area (U+E100 to U+E1FF), so that a story is a short string. The page sends it as base 64 of UTF-8, in a field named text_b64.
  2. What the CCN Cloud answered is PyonKernel’s JSON. Its pyon field writes each line back in printable stand-ins (⤴ for jump, 💬 for nya, and so on), so that a reader can check what was understood.

Example 1 · Twice, and never (×2 and 0)

The story: Mochi jumps and says にゃ, twice; then a nap, never.

⚑ ×2 ⤴ 💬;
0 💤;

What the page sent

U+E101 U+E131 U+E110 U+E120 ;
0 U+E113 ;

Key by key

1. ⚑ (U+E101): the start. Every story begins with it. It is not a move.

2. ×2 (U+E131): two times. A number anywhere in a line multiplies the whole line. It stands before the moves only by custom.

3. ⤴ (U+E110), 💬 (U+E120): jump, then にゃ. Two moves, done in order: that is sequence.

4. No who. Neither line names anyone, so both are Mochi’s.

5. ; then 0 💤: a line multiplied by zero. The nap is written but never done. A child can switch a line off without deleting it, and switch it on again by taking the 0 away.

What the CCN Cloud answered

The two lines, as PyonKernel read them:

{"line":1, "who":"mochi", "numbers":[2], "dice":[], "lamps":[], "times":2,
 "moves":["jump","nya"], "again":false, "pyon":"⚑ Mochi ×2 ⤴ 💬;"}
{"line":2, "who":"mochi", "numbers":[0], "dice":[], "lamps":[], "times":0,
 "moves":["nap"], "again":false, "pyon":"⚑ Mochi ×0 💤;"}

and the steps:

Step Line Round Move Mochi at Onigiri at
1 1 1 jump (1, 1) (4, 1)
2 1 1 nya (1, 1) (4, 1)
3 1 2 jump (1, 1) (4, 1)
4 1 2 nya (1, 1) (4, 1)

notes was empty.

Reading it


Example 2 · Who moves: Mochi, then Onigiri

The story: Mochi walks two squares right; then Onigiri walks two squares up.

⚑ Mochi → →;
Onigiri ↑ ↑;

What the page sent

U+E101 U+E140 U+E117 U+E117 ;
U+E141 U+E114 U+E114 ;

Key by key

1. Mochi (U+E140): who acts. It begins line 1. On the keypad, choosing Mochi on the grid tab makes every key show Mochi.

2. → → (U+E117 twice): two squares right. Each arrow is one square.

3. Onigiri (U+E141): a new who. From line 2 on, Onigiri acts, and the keys on the keypad now show Onigiri. To move both friends together, the who is both (U+E142).

4. ↑ ↑ (U+E114 twice): two squares up.

What the CCN Cloud answered

{"line":1, "who":"mochi",   "times":1, "moves":["right","right"], "pyon":"⚑ Mochi → →;"}
{"line":2, "who":"onigiri", "times":1, "moves":["up","up"],       "pyon":"⚑ Onigiri ↑ ↑;"}
Step Line Move Who Mochi at Onigiri at
1 1 right Mochi (2, 1) (4, 1)
2 1 right Mochi (3, 1) (4, 1)
3 2 up Onigiri (3, 1) (4, 2)
4 2 up Onigiri (3, 1) (4, 3)

No one met a wall (bump was empty at every step), and notes was empty.

Reading it


Example 3 · Near, or else: two lamps make an otherwise

The story: Mochi walks right. If the friends are near, Mochi says にゃ; if they are far, Mochi naps. It was played twice: once with one step right, once with two.

⚑ Mochi →;            ⚑ Mochi → →;
💡near 💬;             💡near 💬;
🌑near 💤;             🌑near 💤;

What the page sent

U+E101 U+E140 U+E117 ;                 U+E101 U+E140 U+E117 U+E117 ;
U+E150 U+E120 ;                        U+E150 U+E120 ;
U+E158 U+E113 ;                        U+E158 U+E113 ;

Key by key

1. 💡near (U+E150): the lamp near. 1 when Mochi and Onigiri stand side by side (one square apart, not diagonally) or on one square; otherwise 0. It is read when the line’s turn comes, not when the story starts.

2. 🌑near (U+E158): the dark lamp near. It reads 1 − near: lit exactly when near is dark.

3. The two lines together. Since near + (1 − near) = 1, exactly one of the two lines happens, never both and never neither. This is how Pyon writes if … otherwise, without a word for either: choice as a product.

What the CCN Cloud answered

One step right: Mochi stops at (2, 1), two squares from Onigiri.

{"line":2, "lamps":[{"lamp":"near","lit":true, "value":0}], "times":0, "moves":["nya"]}
{"line":3, "lamps":[{"lamp":"near","lit":false,"value":1}], "times":1, "moves":["nap"]}
Step Line Move Mochi at Onigiri at
1 1 right (2, 1) (4, 1)
2 3 nap (2, 1) (4, 1)

Two steps right: Mochi stops at (3, 1), beside Onigiri.

{"line":2, "lamps":[{"lamp":"near","lit":true, "value":1}], "times":1, "moves":["nya"]}
{"line":3, "lamps":[{"lamp":"near","lit":false,"value":0}], "times":0, "moves":["nap"]}
Step Line Move Mochi at Onigiri at
1 1 right (2, 1) (4, 1)
2 1 right (3, 1) (4, 1)
3 2 nya (3, 1) (4, 1)

Reading it


Example 4 · Sometimes: the dice

The story: Sometimes, Mochi shows a heart.

⚑ 🎲 ❤;

What the page sent

U+E101 U+E153 U+E122 ;

Key by key

1. 🎲 (U+E153): the dice. It is a factor like a number, but it is 1 or 0 by chance, drawn afresh each time the line’s turn comes.

2. ❤ (U+E122): a heart.

What the CCN Cloud answered

The same story was sent seven times, at 05:58 UTC. These are the plays the paper reports (§5.4). The draws, in order:

Play dice times Steps
1 [0] 0 none
2 [0] 0 none
3 [1] 1 heart
4 [1] 1 heart
5 [1] 1 heart
6 [1] 1 heart
7 [1] 1 heart

Reading it


Example 5 · Again: walking to the wall, and the dizzy ceiling

The stories: Again, while not at the wall, Mochi walks right. And: Again, while at home, Mochi says にゃ.

⚑ 🔁 🌑wall →;
⚑ 🔁 💡home 💬;

What the page sent

U+E101 U+E154 U+E159 U+E117 ;
U+E101 U+E154 U+E152 U+E120 ;

Key by key

1. 🔁 (U+E154): again. It turns the line into a loop: while the lamps are lit, do the line, then read the lamps again. That is repetition with a condition, a while loop.

2. 🌑wall (U+E159): in the middle. 1 while the one acting is away from every wall.

3. 💡home (U+E152): at home. 1 while the one acting is on the square where it began.

4. The ceiling. A loop whose lamp never goes dark would never end. Pyon stops every again after nine rounds, or after the number in the line if there is one (🔁 ×3 is at most three rounds). If the lamps are still lit when the ceiling is reached, the one acting is dizzy (💫 9!) and the page says why.

What the CCN Cloud answered

To the wall:

{"line":1, "lamps":[{"lamp":"wall","lit":false,"value":1}], "times":4,
 "moves":["right"], "again":true, "ceiling":false, "pyon":"⚑ Mochi 🔁 🌑wall →;"}
Round Move Mochi at Onigiri at
1 right (2, 1) (4, 1)
2 right (3, 1) (4, 1)
3 right (4, 1) (4, 1)
4 right (5, 1) (4, 1)

At home:

{"line":1, "lamps":[{"lamp":"home","lit":true,"value":1}], "times":9,
 "moves":["nya"], "again":true, "ceiling":true, "pyon":"⚑ Mochi 🔁 💡home 💬;"}

Nine steps, each nya with Mochi at (1, 1), rounds 1 to 9, and the note:

Line 1: again stopped after 9 rounds, with the lamps still lit; Mochi is dizzy.

Reading it


The kernel behind the answers: its design and its code

PyonKernel is written in Wolfram Language, as one input cell of the notebook kernel/ff_pyonkernel.nb (cell id de8aca6e-345c-4326-8964-f8e6f290a2e1, 210 lines). Evaluating that cell, signed in to the CCN Cloud account ccn, deploys the kernel as a public web API. The excerpts below are taken from the cell as deployed on 2 December 2026 at 02:40 UTC. Lines marked … are left out; nothing else is changed.

The design in one picture

the page ──POST mode=read, text_b64──▶ APIFunction ──▶ is the Origin Pyon's own page?
                                                         │ yes
                                                         ▼
      text ──split at ;──▶ lines ──readLine──▶ who, numbers, dice, lamps, again, moves
                                                         │
                                                         ▼  for each line, in order
                   lamps read on the stage now ──▶ times = numbers × dice × lamps
                   (again: read before every round, at most 9)
                                                         │
                                                         ▼
                   doRound: each move, each square, both friends' places ──▶ steps
                                                         │
the page ◀──────────────── JSON: kernel, grid, start, lines, steps, notes ◀┘

Five decisions shape it:

  1. One reader, one truth. The kernel turns a story into a list of steps, and the page only plays them. Every rule of the language lives in one place.
  2. Stateless. The kernel keeps nothing between calls: no story, no address, no child. A call is a pure function of the story, the grid and the two starting squares, except for the dice.
  3. Read only, and public. There are two modes, ping and read, and no key is needed, so that anyone may try Pyon. A browser may call it only from Pyon’s own pages.
  4. Bounded. Every story ends: at most 2000 characters, 12 lines, 12 moves a line, 9 times a line, 9 rounds of again and 80 steps.
  5. Released only where it belongs. The cell refuses to deploy into any account but ccn, the account that holds only what the public reaches.

1. The account guard

Before anything is written, the cell asks where the name PyonKernel would resolve. Anywhere but ccn, it returns a refusal and writes nothing:

pyonAccountBase = "https://www.wolframcloud.com/obj/ccn/";
pyonAccountOf[] := Quiet[Check[First[CloudObject["PyonKernel"]], ""]];
If[! StringStartsQ[ToString[pyonAccountOf[]], pyonAccountBase], pyonWrongAccount[],
 With[{version = "PyonKernel 2026-12-02 02:40", release = "Pyon 1.0a1",
   publicOrigins = {"https://lossofgenerality.github.io"},
   maxChars = 2000, maxLines = 12, maxTimes = 9, maxMoves = 12, maxSteps = 80, …},
  CloudDeploy[APIFunction[…], "PyonKernel", Permissions -> "Public"]]]

With writes the constants into the deployed code itself, so the kernel needs no other object in the CCN Cloud to read a story.

2. The keys as data

Each key is one row: its name, its code point, its printable stand-in, and the words a child or a grown-up might type for it, in English and Japanese:

keys = {
  {"jump", 16^^E110, "⤴", {"jump", "hop", "leap", "bounce", "ジャンプ", "とぶ", "ぴょん"}},
  {"nap",  16^^E113, "💤", {"nap", "sleep", "snooze", "rest", "ねる", "おひるね"}},
  {"nya",  16^^E120, "💬", {"nya", "meow", "miaow", "にゃ", "にゃー"}},
  {"right", 16^^E117, "→", {"right", "みぎ"}},
  {"twice", 16^^E131, "×2", {"twice", "x2", "*2", "2回", "2回"}}, …};
lampKeys = {
  {"near", 16^^E150, "💡near", {"near", "close", "となり"}, 1},
  {"near", 16^^E158, "🌑near", {"far", "とおい"}, 0}, …};

The last entry of a lamp, 1 or 0, is the polarity: the bright lamp or the dark one. It is the lit of the answer.

3. Reading a line: the longest key first

readLine walks along a line. At each place it tries every way of writing a key, longest first, so that 💡near is read as one lamp and not as a stray 💡 followed by the word near:

tokens = ReverseSortBy[Join[Keys[word], Keys[lamp],
    ToLowerCase /@ diceWords, ToLowerCase /@ againWords], StringLength];
…
hit = SelectFirst[tokens,
  StringStartsQ[low, #] && ! (latinQ[#] && latinQ[StringDrop[low, StringLength[#]]]) &, Missing[]];
If[! MissingQ[hit],
 Which[
  MemberQ[ToLowerCase /@ againWords, hit], again = True,
  MemberQ[ToLowerCase /@ diceWords, hit], dice++,
  KeyExistsQ[lamp, hit], AppendTo[lamps, lamp[hit]],
  KeyExistsQ[multiple, word[hit]], AppendTo[nums, multiple[word[hit]]],
  KeyExistsQ[who, hit], actor = who[hit],
  word[hit] =!= "stop", AppendTo[moves, word[hit]]];
 rest = StringDrop[rest, StringLength[hit]]; Continue[]];

The test with latinQ keeps a word whole: upstairs is not read as up followed by stairs. Each key falls into exactly one class: again, dice, lamp, number, who, or move. Order matters only among the moves, which is why the numbers and the lamps may stand anywhere in a line.

4. A lamp, read on the stage

lampValue[{name_String, lit_Integer}, at_Association, movers_List, g_Integer, start_Association] :=
 Module[{c},
  c = Boole@Switch[name,
     "near", Total[Abs[at["mochi"] - at["onigiri"]]] <= 1,
     "wall", AnyTrue[movers, MemberQ[at[#], 0] || MemberQ[at[#], g - 1] &],
     "home", AllTrue[movers, at[#] === start[#] &],
     _, False];
  If[lit === 1, c, 1 - c]]

near is a distance of at most one square, counted along the grid (side by side, or on one square, never diagonally). wall asks whether any of those acting has a coordinate 0 or g − 1. home asks whether all of them stand where they began. The last line makes the dark lamp, 1 − c. at is the stage now, so a lamp sees what the lines before it have done (Example 3).

5. The product, and the guarded loop

For each line, the kernel reads the lamps, multiplies, and either plays the line that many times or, for again, loops:

lit = lampValue[#, at, movers, g, start] & /@ r["lamps"];
times = Times @@ r["nums"];
If[TrueQ[r["again"]],
 cap = If[r["nums"] === {}, maxTimes, Min[maxTimes, times]];
 n = 0; d2 = drawn; l2 = lit;
 While[n < cap && Times @@ d2 * Times @@ l2 == 1 && moves =!= {} && Length[steps] < maxSteps,
  n++; doRound[n];
  d2 = RandomInteger[1, r["dice"]];
  l2 = lampValue[#, at, movers, g, start] & /@ r["lamps"]];
 ceiling = n === cap && r["nums"] === {} && Times @@ d2 * Times @@ l2 == 1,
 n = Min[maxTimes, times * Times @@ drawn * Times @@ lit];
 Do[doRound[k], {k, n}]]

Times @@ {} is 1, so a line with no number, no dice and no lamp is done once. The ordinary line is the product of Example 1: times * dice * lamps, capped at nine. The again line is a While whose guard is the same product, recomputed after every round from the stage as it now is. Written as algebra, an again line x with lamps c is one term of 1 + x + x² + … : the lamps choose which. It is a guarded star, and cap guarantees that the sum is finite. ceiling is true only when the loop was stopped by the cap with its guard still 1 (Example 5).

6. One round: the steps

doRound[k_] := Do[If[Length[steps] < maxSteps, Module[{bump = {}, next},
    If[KeyExistsQ[arrows, moves[[j]]],
     Do[next = place[at[c], moves[[j]], g];
      If[next === at[c], AppendTo[bump, c]];
      at[c] = next, {c, movers}]];
    AppendTo[steps, <|"line" -> i[[1]], "round" -> k, "tile" -> j, "move" -> moves[[j]],
      "who" -> actor, "at" -> at, "bump" -> bump|>]]], {j, Length[moves]}];
place[at_List, move_String, g_Integer] := Clip[at + arrows[move], {0, g - 1}];

place adds the arrow and Clips to the square: at a wall the position does not change, and the creature is listed in bump (the page squishes it). Every step records where both friends stand, so the page can play any step without remembering the ones before it.

7. The two modes, and the door

Which[
 #mode === "ping", <|"kernel" -> version, "release" -> release, "grammar" -> "pyon", "public" -> True, …|>,
 #mode =!= "read", Failure["BadMode", <|"Message" -> "mode is read or ping"|>],
 ! MemberQ[Append[publicOrigins, ""], origin[]],
   Failure["Forbidden", <|"Message" -> "Pyon is read only for its own pages"|>],
 True, Module[{g = Clip[#grid, {3, 12}]},
   pyonRead[text, g, <|"mochi" -> square[#["mochi_at"], g, {1, 1}],
     "onigiri" -> square[#["onigiri_at"], g, {Min[4, g - 1], 1}]|>]]]] &

ping says what is deployed. read is the only other mode. The Origin header admits Pyon’s own pages and calls with no browser at all (""), and refuses any other web page. The grid is clipped to 3 to 12 whatever is asked. Nothing in the cell writes to the CCN Cloud once deployed. The only CloudGet, in ping, checks whether the two key objects exist and returns true or false, never their contents.


Notes


© Computational Classnotes · CC BY-NC-SA 4.0