My son is in the third grade and his math homework is to play games. The other night we played one that really got me thinking. Each player makes a 4×4 board and puts in any even number between 8 and 48 in every box (note there are more then 16 to choose from and that you can have repeats if you like). I just used the first 16 numbers (8-38) randomly on my grid. Then you roll 4 6-sided dice, add up the total, and then double it (so it’s testing low integer adding and doubling for the homework). You play until someone gets four in a row. As we played we both noticed that 28 kept coming up. I had it once on my board and he didn’t have it at all, so it really just kept extending the game. I told him that 28 would be expected to be the most common (avg roll is 3.5 and 3.5 x 4 x 2 = 28) so we got talking about whether next time we should try a board with all 28s. This post is all about what I learned when trying just that.

I decided to code up the game in Mathematica (this is the century of the decade of the year of the week of the hour of code after all). The low hanging fruit was to match an all-28 board against a board with random numbers on it without any repeats. It’s low-hanging because not having repeats means I don’t have to teach Mathematica how to make a choice when a repeated number is rolled (see below for my try at that). To simulate a roll I just produce 4 random integers between 1 and 6, add them, and double them. Here’s a plot of the probability of each roll:

To check if a bingo (four in a row) happens, I just check the board after each roll for any possible bingos.

Instead of playing matches, I just calculated how many rolls it would take to get a bingo for each type of board. Here’s a histogram of 1000 runs for each type (each bin is the count of the runs that took that many rolls to get a bingo for both types of boards).

I was a little surprised by this result. The random boards beat the all 28s board by a fair margin (on average). Did it surprise you?

So then I started wondering about better boards. I realized that if I wanted to do boards with some repeats on them, I’d have to teach Mathematica an effective strategy for making decisions. For example, say you rolled a 22 and you had 3 22s on your board. How do you decide where to put your bingo marker?

[pause while the reader considers]

What I decided to go with was to go for the spots that help out as many potential bingos as possible. That means corners and the inner square are worth more than non-corner edges. What I mean is that a corner spot could be a part of 3 potential bingos (left-right, down-up, and diagonal). The same is true for the inner square. But the non-corner edge spots only have left-right and up-down. So, if given a choice, it’ll go with one of the better ones. If all choices are in the same sort of spot (either all good or all slightly-less-good) then just do it randomly. However, if any of the choices gives you a bingo, I go with that one.

First I tried boards with randomly selected possibilities on each space. This allowed for repeats, since each space re-ran the random selection. Then I made boards where the randomness just mentioned was weighted by the probability expectation seen above. Here’s a comparison of all 4 types of boards:

It’s really interesting to see that the all 28s board is the worst, on average, even though we expected it to be better based on our (very limited) experience. It’s also interesting to see that the average number of rolls for a bingo is half as much for the weighted random (with repeats) board.

So what’s the best board? I don’t know, but what I did was generate 100 weighted-random boards and play 100 games with each. I then looked for the one with the lowest average. Here’s the winning board:

26 40 24 22

18 36 34 18

38 30 36 26

32 20 26 34

And here’s a histogram of running that board 1000 times:

Note that once it got a bingo in four consecutive rolls! Also note that the board doesn’t have any 28s in it!

Ok, that’s my fun for the week/day/hour of code. I hope you enjoyed it. Thoughts? Here are some starters for you:

- I’m in your son’s class, thanks! But I tried your best board and my friend beat me once. Therefore this is all wrong.
- I’m your son’s teacher and I really wish you hadn’t posted this. Now every single time my students play they tie since they always use the same board.
- I’m a lawyer at a Bingo ™ board manufacturer. I need your mailing address to send a cease and desist letter.
- Here’s a better idea for an algorithm to deal with the choices that need to be made when you have a repeat board, because the one you used is dumb.
- Thanks for this! Now I can quit school and stick it to the casinos!
- Why did you only run 100 boards at the end. What, you didn’t want to stay up even later on a Friday night to let it run longer? Wimp.
- I don’t believe this. The all 28s board should have trumped everything. You must have a mistake in your code.

Wow! This would be a great activity for thermal physics. Where were you last summer when I was preparing for fall term?

Let’s simplify this for use in class. We’ll use two dice and a 2×2 board, and ask for the board that leads to the largest probability of a “walk-off bingo”: a bingo in exactly two rolls. The analog of your all-28 board is a board with 4 7’s. To get a walk-off bingo, we need a sequence of exactly 7 – 7, which leads to a probability of (1/36) = 2.78% probability of a walk-off bingo. I’ll compare this with some different boards that don’t include 7.

Let’s compare with a board of 8-8-6-6. This might seem worse at first glance, but that doesn’t account for the multiplicity. There are now four ways to get a walk-off bingo, 8 – 6, 6 – 8, 8 – 8, and 6 – 6. Each of these individually has a probability of (5/36)^2 = 1.93%, but together the total probability is four times this, or 7.72%. So this board is much better than the all 7’s board, due to the multiplicity.

Of course we can do even better by choosing all four numbers to be different, like 5-6-8-9 (still excluding 7). There are now 12 different possibilities for a walk-off bingo (assuming I did my counting correctly), with a total probability of 18.7%. Wow, that’s bigger than I would have expected.

You could do even better by including a 7; that’s an exercise left for the reader.

Your original problem is more complex, but I expect the same mechanism is at work. Thanks for the great post and idea, and Happy New Year!

Good idea to look at it even more simply. I think this would be very cool for statistical mechanics course. It’s not that hard to code up and you can do all kinds of extensions on it, I would imagine.

My nephew on facebook just posted a suggestion for a board that runs even better than the ones I’ve done:

28 28 28 28

26 26 26 26

30 30 30 30

32 32 32 32

On average it runs a whole turn better. Very cool

wait, I ran 1000 more weighted boards and found one better than that (on average wins two turns faster). Awesome

I’ve been thinking about the tradeoff between repeats (hurts multiplicity) and innate probability. I would try a board like

28 xx xx 34

xx 26 30 xx

xx 32 24 xx

22 xx xx 36

Not sure what to put in for the xx spots. Maybe repeat those 8 in some pattern? My intuition says your nephew’s board has too much repetition. Maybe not though.

This is very interesting! How could this be explained to 3rd/4th grade probability students?

As your son’s teacher, I choose: “Thanks for this! Now I can quit school and stick it to the casinos!”

When talking with Leo about this, we really only talked about the all 28s board and how it would seem to be a good idea. I think it might be interesting to either have the students play a few of these boards or watch the computer do some matches. Also, I think the students could definitely produce the first graph, as it’s just a count of how many times each roll tends to happen. The type of board I’m recommending could be produced on the fly by just rolling 16 times and writing the numbers you get in the 16 boxes. That’s because the rolls will follow the distribution and that’s all my weighted random boards do.

Are you aware you don’t have any “share” links? I was gonna share to all 42 (hey, look at that number) of my tech-side twitter friends, but you’ve made it too hard. (I’m pretty sure that should be some kind of comment starter, too.)

fixed 🙂