In my last post I talked (mostly) about the work behind two expansions for a game I have been enjoying. Something was nagging me about the placement cards (which I listed as expansion 1) which was really about whether there was a fair distribution of spaces of (what is known in the game as) treasures.

Given that I had designed and laid out those cards in Python, I resolved to use that same code to transfer the data to a spreadsheet, and to visualize how frequently each of the 25 water spaces appeared in all 24 cards.

If you read the Python from my prior post, you’ll know that each card was represented as a string of characters, each character representing one of the 25 cells (a for 0,0, b for 0,1, and so on.) Since I wanted to render these results in a spreadsheet, I created a new Google Sheet rewrote the Python as Javascript. The result is in the code sample at the bottom. It’s not efficient. It isn’t meant to be. But by publishing the Apps Script Project as a Sheets Add-On …

it can be used as functions right in the spreadsheet (a new thing for me!)

**So, what were the results?**

What is this saying? The 25 cells represent the cells of a card. The number represents how many cards out of 24 have a treasure in that water space.

So the most common place to find a treasure is right in the center. 20 out of 24 cards have a treasure right in the center.

Just like my sample card, above, and repeated below.

For clarity, I added *Conditional Formatting* on the range, turning it into a poor-person’s heatmap.

Which came out like this:

This colorization shows something interesting:

One thing is obvious: there are only 7 out of 24 chances for treasures to appear in the four cells orthogonally adjacent to the center of the board, at spots (1,2), (2,1), (2,3), and (3,2).

Compare that to this heatmap which shows the distribution of the original six cards.

There, treasures are only found twice out of six times, at (1,1), (1,3), (3,1), and (3,3), but are found five times out of six at (0,2), (2,0), (2,4), and (4,2).

**So, is this meaningful?**

Let’s see. Now, my statistics and probability is rusty, but I think I can pull this out with help from The Internet.

Let’s start by choosing, for instance, one of the (2,1) spaces where treasures occur only 7 times in the deck of 24. What are the chances that when drawing four cards, none of them have a treasure on that space?

Drawing 4 cards out of 24, there are 24C4, or 10,626 combinations. I gave each card a number and the computed all the permutations with the help of this permutations calculator. With that, and more spreadsheet magic, here’s the chances.

Occurrences | Count | % |

0 | 2380 | 22% |

1 | 4760 | 45% |

2 | 2856 | 27% |

3 | 595 | 6% |

4 | 35 | 0.3% |

In other words, almost a quarter of the time a treasure won’t appear in that water space for the whole game.

Now let’s compare that to the odds when drawing from the 6-card deck. There, the spaces with the fewest treasures are one space diagonally from the center, and those spaces only have treasures in two out of six cards.

Drawing 4 cards out of 6, as you do in a game, there are 6C4, or 15 combinations. Thanks to the same permutations calculator and spreadsheet magic, here are the odds of those low-frequency spaces being drawn in a game.

Occurrences | Count | % |

0 | 1 | 7% |

1 | 8 | 53% |

2 | 6 | 40% |

3 | 0 | 0% |

4 | 0 | 0% |

It shouldn’t be a surprise that if a treasures appears on a water space only twice out of six cards, there’s a 0% chance of drawing three cards with treasures on that space.

Let’s compare these side-by-side.

With a deck of six cards, there’s only a 7% chance those specific low-frequency water spaces will remain unpopulated the whole game, while with the deck of 24 cards, those sparsely-populated spaces will be less likely to be populated.

While I’ve never discussed the rules to the game on this post, you can imagine this means someone will make very different decisions about where to spend my time on the board.

**So, what value would work?**

Thanks to all that prework, it took much less effort to find out the odds drawing cards when they appear 8 out of 24 times, or 9 or 10.

So I were to build a deck of 24 cards, I might endeavor to have the spaces least likely to contain treasures to at least appear in the deck 10 times.

And this is just focusing on four cells out of all 25.

**The Moral**

- Designing an expansion can just be about whimsy and fun.
- And if you do that, you might find unexpected results.
- Math can be whimsical and fun.
- And if you do
*that*, you might find unexpected results.

**The Code**

function parse(counts, str, invert) { for (var i = 0; i < str.length; i++) { var a = str.charCodeAt(i) - 97 var row = parseInt(a / 5) var col = parseInt(a % 5) if (counts[row][col]) { counts[row][col]++; } else { counts[row][col] = 1; } } } function dibsimple(x, y) { return dibb(x, y, false); } function dib(x, y) { return dibb(x, y, true); } function dibb(x, y, all) { var counts = []; for (var i = 0; i < 5; i++) { counts[i] = []; } if (!all) { parse(counts, "abdefjmptuvxy") parse(counts, "bdfgijmpqstvx") parse(counts, "bdgiklmnoqsvx") parse(counts, "bdgiklmnoqsvx", true) parse(counts, "cfgijmpqstw") parse(counts, "cfgijmpqstw", true) parse(counts, "cfghijmpqrstw") parse(counts, "cfghijmpqrstw", true) parse(counts, "bcdgikmoqsvwx") parse(counts, "bcdgikmoqsvwx", true) parse(counts, "aefgijmpqstuy") parse(counts, "aefgijmpqstuy", true) parse(counts, "aegiklmnoqsuy") parse(counts, "aegiklmnoqsuy", true) parse(counts, "aceghikmoqrsuwy") parse(counts, "aceghikmoqrsuwy", true) parse(counts, "abdefgjpstuvxy") parse(counts, "abdefijpqtuvxy") } parse(counts, "abcdeklmnouvwxy") parse(counts, "cghiklnoqrsw") parse(counts, "acefhjkmoprtuwy") parse(counts, "bcdfjkmoptvwx") parse(counts, "acegikmoqsuwy") parse(counts, "bdfhjlnprtvx"); return counts[x][y]; }