## Dobble

### January 15, 2016

A little bit of googling led me to some beautiful math based on the finite projective plane (in Euclidean geometry, parallel lines never meet, but in projective geometry, parallel lines meet at the “point at infinity,” similar to an artist’s perspective drawing where the two parallel rails of a railroad track converge at the vanishing point). Using a projective plane of order n, where n is prime, there are n2 + n + 1 symbols and cards and n + 1 symbols on each card. For the game of Dobble (known as Spot-It in the United States) the order is 7, there are 8 symbols per card, 57 possible symbols, and 57 possible cards (Dobble omits 2 of the cards). The following program prints the deck, using numbers instead of symbols; the first set of nested `do`-loops prints the first n2 cards, the second set of nested `do`-loops prints the next n cards, and the final `do`-loop prints the last card:

```(define (dobble n)
(do ((i 0 (+ i 1))) ((= i n))
(do ((j 0 (+ j 1))) ((= j n))
(do ((k 0 (+ k 1)))
((= k n) (display (+ (* n n) i)) (newline))
(display (+ (* (modulo (+ (* i k) j) n) n) k))
(display " "))))
(do ((i 0 (+ i 1))) ((= i n))
(do ((j 0 (+ j 1)))
((= j n) (display (+ (* n n) n)) (newline))
(display (+ (* j n) i)) (display " ")))
(do ((i 0 (+ i 1)))
((= i n) (display (+ (* n n) n)) (newline))
(display (+ (* n n) i)) (display " ")))```

There are 7, 13, 31, 57, 133, … cards for finite projective planes of order 2, 3, 5, 7, 11, … (A060800). Here is the Dobble deck:

```> (dobble 7)
0 1 2 3 4 5 6 49
7 8 9 10 11 12 13 49
14 15 16 17 18 19 20 49
21 22 23 24 25 26 27 49
28 29 30 31 32 33 34 49
35 36 37 38 39 40 41 49
42 43 44 45 46 47 48 49
0 8 16 24 32 40 48 50
7 15 23 31 39 47 6 50
14 22 30 38 46 5 13 50
21 29 37 45 4 12 20 50
28 36 44 3 11 19 27 50
35 43 2 10 18 26 34 50
42 1 9 17 25 33 41 50
0 15 30 45 11 26 41 51
7 22 37 3 18 33 48 51
14 29 44 10 25 40 6 51
21 36 2 17 32 47 13 51
28 43 9 24 39 5 20 51
35 1 16 31 46 12 27 51
42 8 23 38 4 19 34 51
0 22 44 17 39 12 34 52
7 29 2 24 46 19 41 52
14 36 9 31 4 26 48 52
21 43 16 38 11 33 6 52
28 1 23 45 18 40 13 52
35 8 30 3 25 47 20 52
42 15 37 10 32 5 27 52
0 29 9 38 18 47 27 53
7 36 16 45 25 5 34 53
14 43 23 3 32 12 41 53
21 1 30 10 39 19 48 53
28 8 37 17 46 26 6 53
35 15 44 24 4 33 13 53
42 22 2 31 11 40 20 53
0 36 23 10 46 33 20 54
7 43 30 17 4 40 27 54
14 1 37 24 11 47 34 54
21 8 44 31 18 5 41 54
28 15 2 38 25 12 48 54
35 22 9 45 32 19 6 54
42 29 16 3 39 26 13 54
0 43 37 31 25 19 13 55
7 1 44 38 32 26 20 55
14 8 2 45 39 33 27 55
21 15 9 3 46 40 34 55
28 22 16 10 4 47 41 55
35 29 23 17 11 5 48 55
42 36 30 24 18 12 6 55
0 7 14 21 28 35 42 56
1 8 15 22 29 36 43 56
2 9 16 23 30 37 44 56
3 10 17 24 31 38 45 56
4 11 18 25 32 39 46 56
5 12 19 26 33 40 47 56
6 13 20 27 34 41 48 56
49 50 51 52 53 54 55 56```

You can run the program at http://ideone.com/vF7goP. Thanks are due to Ben Simon, who suggested this exercise to me, and who provides a rather different solution at his blog.

Pages: 1 2

### One Response to “Dobble”

1. matthew said

Nice problem (and solution) but don’t we need some extra constraints, for example, that every symbol appears on exactly 8 cards? Otherwise there are significantly smaller suitable decks, eg. this one (which I think is the smallest possible) with only 9 cards and 36 symbols:

``` 1  2  3  4  5  6  7  8
1  9 10 11 12 13 14 15
2  9 16 17 18 19 20 21
3 10 16 22 23 24 25 26
4 11 17 22 27 28 29 30
5 12 18 23 27 31 32 33
6 13 19 24 28 31 34 35
7 14 20 25 29 32 34 36
8 15 21 26 30 33 35 36
```