Wednesday, June 19, 2013

More Spot-It! Math

In a previous post, I mentioned some work with pencil and paper that led me to a certain formula. This post adds a some detail, and I hope it'll be easier to follow. As you may recall from that previous post, I use M to refer to the number of symbols on a given card, and N to refer to the number of distinct symbols (or "alphabet") from which the symbols are drawn. So, continuing on, here's my exploration of the puzzle starting with M=3.
1|ABC
2|A
D
F
E
G
3|A
4|B
DF
5|BEG
6|CDG
7|CEF
To approach the problem I decided to list each card's symbols in increasing alphabetical order. Please refer to the table at left. The progression A-B-C, A-D-E, A-F-G is perhaps obvious. What of the B-x-x cards?

After each "B", we take vertical slices of the dotted blue square, the first slice being the D F in the thin black border. The thing to note with the "B"s is that the "F" is directly below the "D" (i.e., it's down one row and zero symbols to the right).

Similarly on card 5, B-E-G, the "G" is directly below the "E" in the dotted-blue square.

Regarding the "C"s: note on card 6, C-D-G, that the G is below and to the right of the D in the dotted blue square. Card 7 (C-E-F) shows the principle (we'll expand on this later) that when "below and to the right" runs off the right-hand edge of the dotted blue square, we simply resume counting from the left-most symbol in the same row within the dotted blue square. Thus card 7's C-E-F.

So for cards matching the pattern B-x-x, the 2nd "x" is directly below (i.e., displaced zero symbols to the right) of the 1st "x". For C-x-x, the 2nd "x" is displaced one symbol to the right of the 1st "x". How did I arrive at this? Trial and error and eventual "success."

This solution is symmetric in that each of the 7 symbols appears on 4 cards; any given pair of symbols appears upon one and only one card. (Wait, does every possible pair of symbols appear on a card? Yes.)

Suppose we have M=4, N=13? Does the pattern above generalize? What will we do with cards D-x-x-x—would each subsequent "x" be one row below and two symbols to the right of its predecessor "x"?

1|ABCD
2|A
E
H
K
FG
I J
L M
3|A
4|A
5|B
EHK
6|BFIL
7|BGJM
8|CEIM
9|CFJK
10|CGHL
11|D E J L
12|DFHM
13|DGIK
In a word, "Yes." As the table at right shows, the B-x-x-x cards take vertical slices (a subsequent "x" is directly below the preceding "x"). The 3rd (4th) symbol in a C-x-x-x card is one symbol down and to the right of the 2nd (3rd) symbol within the dotted blue square, as C-E-I-M. Again, if you'd run off the right-hand end of a row, continue counting from the left, staying within the dotted blue box, as in card 9, C-F-J-K.

In the D-x-x-x cards, symbols are one down and two to the right of their predecessors within the dotted blue square, again resuming counting from the left when we run off the right-hand side of a row: thus D-E-J-L, D-F-H-M, D-G-I-K.

As in the M=3,N=7 case, we have each of the N symbols appearing on M cards each; every possible pair of symbols appearing on one card; every pair of cards having one and only one symbol in common. At least so far, then, the solution generalizes thus:

  1. one card with the first M symbols (e.g., A-B-C-D in the table at right)
  2. M-1 cards, which include the (M-1)×(M-1) blue-dotted square region
  3. (M-1)2 cards (in the table at right, three B-x-x-x cards, three C-x-x-x cards, three D-x-x-x cards). Each set of M-1 cards takes one symbol from each row of the blue-dotted square:
    • the B-x-x-x cards take vertical slices, i.e., each subsequent symbol is zero columns to the right of its predecessor in the previous row;
    • in the C-x-x-x cards, each subsequent "x" comes from one column to the right of its predecessor in the previous row (and if you're about to run off the end, resume counting at the far left of the same row);
    • in the D-x-x-x cards, each subsequent "x" comes from two columns to the right of its predecessor in the previous row (and if you're about to run off the end, resume counting at the far left of the same row);
    • … and so on
    If (M-1) is a prime number, then the above procedure yields M-1 sets of M-1 symbols in the blue-dotted square. Each set of M-1 symbols has one from each row in the blue-dotted square. And each set has at most one symbol in common with any other set. For example, E-H-K and E-I-M have only the "E" in common. And either set has only the "E" in common with E-J-L.
    Exercise: What if the (M-1)×(M-1) square is 4×4? Would the D-x-x-x-x cards run into some kind of trouble? (Answer: Yes. And I haven't figured my way out of it.)
This yields (M(M-1)+1) cards total, and the same number of symbols. As suggested in my snarky "Exercise:" comment, the above solution works unaltered only when M-1 is a prime number—which, fortunately for me, is true when M is 8.

And that is true for Spot-It!—each card has eight symbols (M=8), and the "optimum" value of N is 8*7+1=57 symbols, which allows for a deck of 57 cards. In my "ideal" (symmetric) deck, each of the 57 symbols would appear eight times (i.e., once on each of eight cards).

How does this relate to the actual Spot-It! cards? More on that in a subsequent post.

No comments: