Search code examples
algorithmmathpseudocode

What are the mathematical/computational principles behind this game?


My kids have this fun game called Spot It! The game constraints (as best I can describe) are:

  • It is a deck of 55 cards
  • On each card are 8 unique pictures (i.e. a card can't have 2 of the same picture)
  • Given any 2 cards chosen from the deck, there is 1 and only 1 matching picture.
  • Matching pictures may be scaled differently on different cards but that is only to make the game harder (i.e. a small tree still matches a larger tree)

The principle of the game is: flip over 2 cards and whoever first picks the matching picture gets a point.

Here's a picture for clarification:

spot it

(Example: you can see from the bottom 2 cards above that the matching picture is the green dinosaur. Between the bottom-right and middle-right picture, it's a clown's head.)

I'm trying to understand the following:

  1. What are the minimum number of different pictures required to meet these criteria and how would you determine this?

  2. Using pseudocode (or Ruby), how would you generate 55 game cards from an array of N pictures (where N is the minimum number from question 1)?

Update:

Pictures do occur more than twice per deck (contrary to what some have surmised). See this picture of 3 cards, each with a lightning bolt:3 cards


Solution

  • Finite Projective Geometries

    The axioms of projective (plane) geometry are slightly different than the Euclidean geometry:

    • Every two points have exactly one line that passes through them (this is the same).
    • Every two lines meet in exactly one point (this is a bit different from Euclid).

    Now, add "finite" into the soup and you have the question:

    Can we have a geometry with just 2 points? With 3 points? With 4? With 7?

    There are still open questions regarding this problem but we do know this:

    • If there are geometries with Q points, then Q = n^2 + n + 1 and n is called the order of the geometry.

    • There are n+1 points in every line.

    • From every point, pass exactly n+1 lines.

    • Total number of lines is also Q.

    • And finally, if n is prime or a prime power, then there does exists a geometry of order n.


    What does that have to do with the puzzle, one may ask.

    Put card instead of point and picture instead of line and the axioms become:

    • Every two cards have exactly one picture in common.
    • For every two pictures there is exactly one card that has both of them.

    Now, lets take n=7 and we have the order-7 finite geometry with Q = 7^2 + 7 + 1 . That makes Q=57 lines (pictures) and Q=57 points (cards). I guess the puzzle makers decided that 55 is more round number than 57 and left 2 cards out.

    We also get n+1 = 8, so from every point (card), 8 lines pass (8 pictures appear) and every line (picture) has 8 points (appears in 8 cards).


    Here's a representation of the most famous finite projective (order-2) plane (geometry) with 7 points, known as Fano Plane, copied from Noelle Evans - Finite Geometry Problem Page

    enter image description here

    I was thinking of creating an image that explain how the above order-2 plane could be made a similar puzzle with 7 cards and 7 pictures, but then a link from the math.exchange twin question has exactly such a diagram: Dobble-et-la-geometrie-finie

    Fano Plane