Tag Archives: Probability

Leo designed a maze game (roughly) based on quantum mechanics and entanglement.

Here’s the board (the player tokens are the dime and quarter):

Each square represents a quantum state, so the maze is a state space.There are six paths out of each state, to some other state (or back to itself). (Well, there are supposed to be six paths out of each state, but Leo was being highly disorganized in drawing the maze, so we ended up with a few less in the latter states, but anyway…)

Both players start out in the start state, entangled together. Rounds are collective, that is, players play together. A round begins by rolling two die: First the count die (the green one, in this case) is rolled, and then the path die (yellow) is rolled the number of times shown by the count die. So, for example, if the count die rolls 3, we would then roll the path die three times. Let’s say that the path results are: 4,2,4. Each player then chooses one of the paths to take from their current state to a new state, trying to reach the end state. BUT, there is an “exclusion” constraint(*) that requires that only one player choose each value. So, in the example above (4,2,4), if one player wants to move on path 4, and the other on path 2, there is no problem. Similarly, if both want to move on path 4, there’s no problem because there are two 4s. However, if both want to move on path 2, you have to roll against one another for priority, and the player with the highest roll gets to choose his or her path first, and the other player is left with whatever paths are left.

Simple, but fun!

We had ideas for a bunch of enhancements, esp. re-entanglement if we ended up on the same state, and I had this fantasy of using <bra|OP|ket> notation to record the paths, but we never got around to these. It would have been a bit better with a more state space maze.

(*) It occurred to me that it would have made more physical sense for the exclusion constraint to keep the players out of the same state, but that would have required redesigning the board from scratch, with two starts next to one another, or something. We’ll have to think about this for a redesign.

[It slightly bothers me that the last few posts are mostly MineCraft-related. But as Leo has been getting more and more interested in nuances of MineCraft, I’m trying to guide this interest toward math instead of evil. (And “evil” is MineCraft is quite a lot less evil than with many other things he could be getting addicted to.) (Some day I’ll talk about MineCraft addiction management strategies … when I figure some out!)]

Interestingly, in MineCraft, the term “seed” makes for a convenient pun; Leo understood perfectly that the “seed” is what the world is grown from. But in reality, of course, is comes from the concept of a random number seed, which is how the pseudo-random number generator uses to create the random stream that starts off the whole world, and everything in it. This, of course, is how it’s possible to publish the seed, as in the web page above, and others can get back to the same exact (initial) world.

So I turned this into a lesson plan on random numbers, pseudo-random numbers, determinism and non-determinism, and one of Leo’s favorite topics: Quantum Computing and cryptography.

Leo got right away that 4+5 is determistic, and if you were to print the result in a loop (bottom right scribble) you’d get 9 every time, but 4+Rand(10) would randomly give you a number between 5 and 14. (I’m using 1-origin — someday I’ll go into that with Leo … actually, I may have already at some point.) Note, also at the bottom left the important observation that “All non-quantum computers are DETERMINISTIC.”

So, the mystery is:

To translate my scribbles:

All (non-quantum) computers are deterministic.

Rand(#) [which is a computer function] seems to be non-deterministic. (We tried this on the iPad in the BASIC interpreter.)

The mystery (apparent paradox!) is: How does Rand work? (We had a brief passing philosophical discussion about paradox v. conundrum.)

The answer, of course, is:

PSEUDO-RANDOMIZATION – Ensued a long interesting discussion of possible pseudo-randomization algorithms, the meaning of “Mod” (the modulo wheel at the bottom center), and so forth. (This board had lots of erasures; You’re only seeing the end product!)

The key concept, which closes the loop on MineCraft seeds, is that the computer needs to have something external in order to seed the pseudo-randomization. That’s what the box around MineCraft is. We talked a lot about where the computer could get a seed. One place is obviously that you give it a specific seed. In that case what’s external is you! But what about when you don’t give it a seed? (Leo’s initial solution, of course, was to use Rand() … 🙂 After explaining why this wasn’t going to work (can you say: “infinite regress”?) And quantum fluctuations, I posed the following problem: Suppose that you were locked in the kitchen with all the lights off at night (we actually did this exercise, of course), and needed a pseudo-random seed…. It only took a few seconds to get the right answer to this one:

The whole thing can be played with just pens and your old, unused business cards (who uses business cards anymore!?), a coin, a 4-sided die, and a 10-sided die. Here’s a picture of the game someplace in the middle of play (the calculator isn’t needed; it was just sitting on the table):

Give each player 5 blank cards. Players divide each of their cards into 4 sections (see pic), and label each section with what phenotypic characteristic they represent. In this case we had “S” for size, “A” for number of arms, “E” for number of eyes, and “B” for brain power (intelligence). You create your initial creatures by entering a number for each creature feature, with the only constraint that they must add to 20. Then you pile them all up, shuffle them, and hand the back out to the players randomly. (This randomization is optional; the creator of the creatures may wish to keep their own hoards.)

Each round of play consist of these steps:

Each player chooses two creatures to mate and puts them in front of him.

A new creature is create with empty features.

Reassortment: You flip a coin for each feature to see if the new creature will inherit the feature value from the “mother” (heads, for example) or “father” (tails), and write in the appropriate value. So you’d flip four times for S, A, E, and B.

Random Mutation: Next you roll the four sided die ONCE to see which feature is mutated. (You could use a 5-sided die, and let 5 be “no mutations”.) So, say I roll a 2, then I’m going to mutate the Arms (A) in the offspring. Then I roll the ten sided die to decide what the new mutated value is. So, if you look at the 4th card from the left in the above picture there’s what appears to have been a mutation of B from 3 to 5. Note that this breaks the “sums to 20” rule — no problem; that rule only applies to initial setup.

Survival of the Fittest: Finally, the offspring “battle” in the usual Pokemon sense. You can make these battles as complex or simple as you like, using the different features differently. We just added up the feature values and the creature with the greatest total wins.

The winning creature goes back into the player’s hand, but he has to toss out one card (you can only have 5 cards at a time).

The losing creature is destroyed. (And the player who held it does not have to destroy any cards).

This simple games turns out to actually be quite fun; we played it for a while!

Leo has had a couple of bouts with video game addiction, which we pretty actively stomp on, but it doesn’t make any of us happy to have to ruin his excitement, even if it is about something completely stupid. Last year in the JCC after school program he was exposed to Plants v. Zombie, and since then it has come up on occasion as something he wants to play. Recently, in a moment of stupidity, I gave in and got him the iPad PvZ2 game. Unfortunately, he was immediately hooked — like when crack addition is depicted on TV! — so that all he thought about, spoke about, depicted in his drawings, etc. was PvZ.

Now, PvZ isn’t the worst game in the world; it’s pretty clever, and at least it’s not shooting people with guns and having their blood splatter all over! But the level of addiction that Leo exhibited was hard to control, and when we tried taking it away he would become quite emotional. We would have ended up taking it away anyway, but instead I decide to try to redirect his interest into something slightly educational, to wit:

DICE versus ICOSAHEDRA (1)

To make a long story short, we invented a dice-based analog to PvZ that has pretty much the same strategy components, but with a whole lotta ‘rithmetic (and some probability) along the way! Moreover, this game is interactive, so kids can play it together, or you can play it with your kids.

(I even convinced Leo to write-out the instructions quasi-neatly!)

The basic idea is that you get one of those large random die collections, which are cheap, and actually fun in-and-of themselves. (Every home should have at least 50 random die!) The zombies are played by icosahedral die. A standard 6-sided die is the zombie creator. The plants are played in various complex ways by the other various-shaped die (see below). The sun (which is the giver of points to grow new plants) is also a die (ten-sided works well, preferably with 00 10 20 …), and so on.

[The game in some random state of play: Energy score pad to the left. Sun is the yellow transparent die top right. “Lawn mowers” are the playing-card dice on the left margin of the field. Plants are purchased from the top row — ex. “PS” = Pea Shooter” (costs 40 energy) — When a plant is purchased and placed, a new one of that type takes the old one’s place at the top row. The green die next to the sun is a sun flower (SF). I think that this multiplies the energy you get from the sun … or something. I have to admit that I wasn’t quite clear on the slightly random rules that Leo made up for the various plants! Right side is the zombie creator die (white 6-sided) and several waiting zombies (icosahedra). There’s also a pea shooter there (for an unknown reason).]

The rules we ended up with were slightly random, aside from the principle that the larger the number of sides on the plant-die, the more powerful, and of course more expensive, the plant.

Game play is in four phases:

Create or move zombies. Roll the zombie creator (6-sides). 1-3 any zombies already on the board move (person playing the zombies can distribute the movement as desired). 4-6 a new zombie is created: Roll the chosen zombie (icos die) to assign that zombie’s health level and place it on the board. If there are no more zombies that can be placed, when the last zombie is removed from the board, the gardener wins.

Roll sun and plant player (aka. gardener) collects energy from the sun.

Gardener buys and plant plants, subtracting from energy in the obvious way.

Plants attack. The specifics of attack mechanics is different for each plant. For example, the PvZ Pea Shooters are played by 4-sided pyramidal dice, which are simply rolled and then the sum score is distributed subtractively among the zombies on that row, as desired by the gardner. And so on. Any zombie that reaches zero is removed from the board. Usual rules apply for zombies that reach the gardner’s side: First one gets run over by the lawn mower, after that zombies win.

That’s about it. You can make it as simple or complex as desired by modifying the plant rules. For example, our game had a black six-sided (standard) die that stood in for fertilizer. It was pretty expensive, but it multiplied the strength of a plant attack, so that if the plant roll was, say, a 4, and the fertilizer roll a 5, then the total attack was 20. You can expand upon the rules as desired to push the players into more and more complex math.

It’s a little hard to explain how this works. The Q-Ba-Maze has several sorts of elements:

Ones that drop straight through (straight-throughs)

Ones that drop to one side (one-sides)

Ones that drop to either side more-or-less randomly (either-sides)

By judicious arrangement of these elements — details left to the reader — it’s pretty easy to create a Galton Machine that’s essentially as large as you like.

Here’s Leo’s lab notebook for our first run of the device:

(Reader’s guide for 5.5 year old penmanship: Numbers down the left are the replication, and it says “Prob Exp” across the top. I wanted him to write out “probability experiment”, but could see that it was going to take up the whole page, so we did an impromptu lesson on abbreviations! Then there’s a bunch of math and carries, which is why all the ones along the top.)

Some suggestions:

First, make sure that you put one of the large columns and a straight-through element at the top so that you appropriately de-bias the initial drop. Here’s a close up that shows the top a little more clearly.

Second, use a set of straight-throughs at the base to catch the balls, otherwise they end up all over the place, and are hard to count. You can see that in the above picture as well.

Finally, use a straight-through element at each stage, otherwise the fall from the previous stage will tend to bias the either-side toward the side opposed to that from which the ball arrived, and will bias the results towards the outside of the machine. Here are a couple of close-ups that show this a bit more clearly:

Five balls is a good number to drop through the size machine depicted here. If you’ve balanced the machine well (an iPhone level helps a lot!), they will assort randomly just in the nice way predicted by the central limit theorem…statistically speaking, of course! 🙂