Pangine

demos

Demos

Each demo runs the current Rust engine in this browser tab with a memory of its own. Change what it remembers or what it asks, and it answers again.

Every answer below is a Pangine answer, shown with the evidence behind it. Each demo also lists the literal commands it ran, which work the same way in the console or in the workbench on the overview page. Nothing is sent to a server.

1. Complete a new family from remembered ones

Two remembered families each say who is the parent of whom and who is the grandparent of whom. The question is about a family Pangine has never seen: Joe is the parent of Sue, Sue is the parent of Kim, and Joe is the grandparent of whom?

remembered families

a new family

Who is [Joe] the grandparent of?

Starting the browser engine...

@ asks exactly, and no remembered family mentions Joe, so it finds nothing. @~ compares the question with each remembered family as one complete case. Joe, Sue, and Kim differ from each family's people in five name occurrences while both relationship names agree, so each family sits at distance 5. In each family the grandchild sits where the question's [Kim] sits, so each family answers [Kim] in the question's own terms.

Rename the new family's people and the answer follows them. Name its grandparent Tom, and Tom's family sits at distance 3, nearer than Liz's family at 5, because the two families now share a name. Adding a family adds one more case behind the answer.

2. Answer pairs never seen together

An early Pangine design note asked for answers composed from parts seen separately, ranked below answers seen whole. Seven remembered experiences hold parts shaped like X->A and B->Y; four of them hold a complete pair. The question asks for every X and Y that complete both parts.

remembered experiences

The question is {m} @ ({x}->[A])([B]->{y}), then the same question with @~.

Starting the browser engine...

@ returns the four pairs observed whole, each with probability 1/4. @~ also lets the two parts come from separate experiences, which composes five pairs never seen together. Its probabilities mix the two levels with the Witten-Bell rule, so the pairs observed whole stay ahead: 9/40 for C with D, down to 1/60 for H with G.

Uncheck experiences to forget them, and the table recomputes from what remains. With only [C]->[A], [B]->[G], and [H]->[A] left, @ finds nothing, and @~ composes C with G and H with G, each with probability 1/2.

3. Tic-tac-toe that learns while you play

Pangine's first version came with a tic-tac-toe player. It remembered each board with the move it made, added the moves from games it won to its memory, and chose its next move with ^. This demo runs the loop of MENACE, Donald Michie's 1961 matchbox learner, written in Pangine syntax. MENACE also learns from draws and losses. Games against you teach it the same way as its training games do.

Pangine plays
choose with
memory

Pangine is choosing...

Against you, Pangine has won 0, drawn 0, and lost 0.

Pangine's matchbox for its last move

Pangine shows the beads behind each move it makes here.

train against

Measured in this browser runtime, with sixteen fresh memories each trained for 200 games: playing first against perfect play and choosing with ^, Pangine lost 16% of games 1 to 50 and under 1% of games 151 to 200, so it learns to hold perfect play to a draw. Drawing with ^~ learned more slowly, from 72% to 19%. Graded memory slowed the first player too, from 29% to 8%, because boards that look alike often need different moves.

Playing second is harder. Against perfect play, exact memory lost nearly every game: its matchboxes ran out of beads and it resigned. Graded memory kept borrowing wins from similar boards and lost 90% of games 151 to 200 instead of 99%. Against an opponent that plays at random 30% of the time, graded memory's losses fell from 82% to 65%, and exact memory's from 84% to 77%. This is the first version's loop with losses added, not a strong player.

4. Divide the memory

When I first thought about scaling Pangine, the model was closer to map/reduce: divide the remembered experience among separate engines, let each one match its own share, and combine their partial answers. Here eight remembered families are divided among partition engines running in this tab, and the new family from the first demo asks its question again.

partitions

Starting the browser engine...

A hash of each family's canonical spelling picks its partition, so each family's evidence stays in one place, and the families do not divide evenly. The question goes to every partition. Each one matches its own families and returns a partial answer, and the engine you talk to joins the parts and grades the rows exactly as one engine would. Change the number of partitions and the families move, but the answer and the families behind it stay the same.

Losing a partition loses the families it held, as if its machine had been replaced by an empty one. The next answer comes from the families that remain, exactly as if Pangine had never seen the others, and dividing the memory again does not bring them back. Start over to remember all eight again.

In this browser the partitions take turns. Natively each one runs on its own thread, and on a 16-core machine a graded question over 8,000 remembered families took 375 ms across 8 partitions instead of 717 ms in one engine. Small questions pay for the trip to every partition and back: a small exact question took 0.13 to 0.24 ms divided instead of 0.09 ms. The partitions share one process; Pangine has no network protocol.