What You Don’t Know Can’t Help You

An inconsequential information leak.

Phil Do
7 min readApr 18, 2019

Working on Twelvesmith, I was sidetracked into a rabbit hole on the topic of “the experience of randomness”. Just how random does the game need to be?

I mean, is that even a coherent question?

As a point of reference, let’s start with the classic gamble- shell game.

Which cup contains the ball?

What’s that? You were supposed to witness the shuffling? And it’s unfair to make you blindly guess? Oh.

Pick a cup! Left, Right, or Middle. You pick Left? Ok- bold choice. Left it is.

Now that you’ve done that, what are the chances you’re correct?

Your chances of being correct in choosing the Left cup are actually 0%. That’s because the ball was in the Middle cup. It was decided before you chose, and any guess that wasn’t “the Middle cup” was going to be wrong 100% of the time.

Fun.

Well, that wasn’t very helpful.

To give this experience some grounding, we can look to the wikipedia entries on Random vs Pseudorandom; you will see an immediate reference to the “predictability” of a process.

This offloads the “degree of randomness” onto the mind of a “predictor” rather than to some “objective property inherent to a phenomenon”.

As the ball-shuffler, I know the ball is in the Middle cup. It’s nonsense to tell me that there’s a 1:3 chance it’s in each cup.

But for you, the ignorant player, assigning a probability to what can be considered a “Random” event is strategically helpful. (You can choose how much to wager, or what the expected returns should be, or simply decide it’s not worth playing.)

A movie reference.

Before we get to the leak, I’m going to plug that game I’ve been working on that started all this: Twelvesmith.com

Play for free @ twelvesmith.com , then download the app!

The rules are simple:

1. Combine adjacent numbers on a hex grid to increase their value by 1
2. Split numbers into an adjacent empty space to create a new number, randomly chosen below the value of the split number
3. Destroy blockers by combining into an adjacent space
4. Get to 12

As you might have guessed from the pretext, we’re going to look at (one small implication of) the rule containing the word “Random”.

But first (sorry!) we’re going to take one last digression to make sure everyone is caught up to speed on how programmers manage randomness.

It all comes down to rand.

rand is a function that uniformly, unpredictably, produces a number in [0,1). Essentially- between 0 and 0.9999999....

Side Note: The degree to which rand itself is pseudorandom or not (including any issues with precision), is outside the scope of this discussion.

From this source, we can draw upon any nature of randomness. Do we want to simulate a coin flip? We can use heads = (rand < 0.5). Do we want to pick a random integer between 1 and 100? number = (rand * 100)+1 (then drop any precision beyond the decimal point).

With that out of the way, let’s get back to Twelvesmith.

The way Twelvesmith uses rand to determine which tile results from a split is not clever-

//Step 1: pick a random number
var computedrand = rand();
//Step 2: map it to an integer < the value of the source tile
var split = floor(computedrand * (source-1)) + 1;

Assuming a source of 4, this results in a mapping from computedrand to split as follows:

You should read this as “if computedrand is between 0 and 0.33, it results in a split of 1”, etc…

Assuming a random, even distribution across computedrand, we can expect a random, even distribution across split. Pretty straightforward stuff!

From the perspective of a predictor, what should you expect from the possible next moves in the following scenario:

I want to split into the selected (white) tile.

Well, the rule states that a split results in a tile “randomly chosen below the value of the split number”.

So if I split from the 5 tile, I very well might get a 2. If I split from the 4 tile, I may instead get a 3. Who knows!

These statements are true from the perspective of the player. But from the perspective of the computer- the ball is already under the cup.

The ball, in this case, isn’t the resulting tile value. It can’t be- the game doesn’t yet know from which source tile you will split!

Instead, the ball is the value of computedrand. And because we know how computedrand gets used, we might be able to squeeze out a bit more information than “the rule” alone articulated.

In the mapping from computedrand to split, the only variable is source. So, we can draw that same mapping across multiple possible sources:

So, while we don’t actually know specifically where computedrand is, we can infer something about the relationship between the possible ways it can be used.

You can play around by dragging computedrand, and seeing the corresponding outcomes from different source values:

JSFiddle: https://jsfiddle.net/q3hn1pyk/show/embedded — click source value to toggle

Do you see a pattern?

If you split from a higher tile, the result will never be lower than had you split from a lower tile!

(source: https://gph.is/1sFVbys)

But does this really matter?

I mean, no? Not really. After all, this is just a fun little web game.

False alarm.

But, rephrased: Is this information strategically helpful?

Well… I’m not sure.

To consider that problem properly, we’ll first get the (less interesting) problem of “fixing it” out of the way.

//Step 1: pick a random number
var computedrand = rand();
//Step 2: map it to an integer < the value of the source tile
var split = floor(computedrand * 27720) % (source-1) + 1;

Side Note: 27720 is the LCM of 1–12, ensuring redundant encapsulation between any pair of values < 12. This differs from the visualization as that many partitions would not fit on one screen.

The specifics of this solution are unimportant- a quick visual/interactive example should communicate the general idea:

Using this method, the split from a 4 tile resulted in a higher number (3) than the split from a 5 (1)! Success!

As an interactive:

JSFiddle: https://jsfiddle.net/en17Lwo3/show/embedded — click source value to toggle

All outcomes from available moves are now functionally completely independent! No information can be gleaned about “what would have been”, from what was.

Has this fix robbed us of any strategic edge? Have we actually changed anything?

Or, more concretely- would you ever play any differently depending on which of the above functions are implemented?

Personally, my answer is probably no.

But that may not be enough- one final thought experiment!

Let’s play another betting game. This time, it’s centered around a single six-sided die.

You get to make one of two bets, and then roll the die. If you win your bet, you get $1Million! If not, you get nothing.

The two bets you can chose from are as follows:

A: “I bet that the D6 will roll a number less than 5.”
B: “I bet that the D6 will roll a number less than 4.”

Game 1

Obviously, it would be silly to choose bet B, when bet A is strictly better.

Ok, now let’s instead play the following game. Same rules, but this time, the bets to choose from are:

A: “I bet that the D6 will roll a number less than 5.”
B: “I bet that the D6 will roll an even number.”

Game 2

I’m still sticking with A. …Right?

Your personal decision aside, is there any difference at all between the two games? Is there any difference in the decision to be made?

They’re both games of blind guessing.
For both games, bet A has odds of 4:6.
For both games, bet B has odds of 3:6.
For either game, the optimal strategy is to choose A.

So, no? There is no difference.

Tell that to the guy who rolled a 6.

The guy who rolled a 6. (source: https://gph.is/2eOICLC)

The “Randomness” of an event is a property contained within the mind of a predictor. And a mind is much more than than a list of known information.

Do the different implementations of “a random split” in Twelvesmith matter?

After all, it’s a fun little web game! And games are made to affect in someone the experience of “rolling a 1 when they might have rolled a 3, if only they had taken the bigger (dumber) risk!”

But, ultimately, no.

It’s a statistical lie to ascribe meaning to “what would have been if…”. And the phenomenological lie of “would-have-been” needs no assistance from overly-complicated randomization implementations (especially ones that would require your users to snoop your use of rand to appreciate…).

So there’s our hard answer: this rabbit hole was a waste of time.

There’s still a lingering difficulty in accepting that. “If you split from a higher tile in Twelvesmith, it will never result in a lower value than had you split from a lower tile” feels like it’s saying… something. How is that not useful!? Why does my lizard brain insist that tip is worthwhile?

If you have any ideas, or think there are more intuitive ways to explain away why it is meaningless, please let me know!

If instead you’ve had your fill from chasing rabbits down holes, I hope you at least had some fun reading! And I’d love if you would check out our game- Twelvesmith.

--

--