What is the algorithm to generate the cards in the game "Dobble" ( known as "Spot it" in the USA )?h

Here is an algorithm to generate a projective plane for every N prime. It will work for N power of prime if the computation of "(I*K + J) modulus N" below is made in the correct "field".

// N*N first cards
for I = 0 to N-1
   for J = 0 to N-1
      for K = 0 to N-1
         print ((I*K + J) modulus N)*N + K
      end for
      print N*N + I
      new line
   end for
end for

// N following cards
for I = 0 to N-1
   for J = 0 to N-1
      print J*N + I
   end for
   print N*N + N
   new line
end for

// Last card
for I = 0 to N-1
   print N*N + I
end for
new line

Here is a C code inspired from @karinka's answer with a different arrangement of symbols.

It works for $n$ being a prime number (2, 3, 5, 7, 11, 13, 17, ...).

Number of symbols in a given card = $n + 1$

Total number of cards = $n^2 + n + 1$

Total number of symbols = $n^2 + n + 1$

#include <stdio.h>
#include <stdlib.h>

#define PRINT(x) printf("%2d  ", (x)+1)

main() {
    int i, j, k, r = 0, n = 7;

    // first card
    printf ("Card %2d:  ", ++r);
    for (i = 0; i <= n; i++) {
        PRINT (i);
    }
    printf ("\n");

    // n following cards
    for (j = 0; j < n; j++) {
        printf ("Card %2d:  ", ++r);
        PRINT (0);
        for (k = 0; k < n; k++) {
            PRINT (n+1 + n*j + k);
        }
        printf ("\n");
    }

    // n*n following cards
    for (i = 0; i < n; i++) {
        for (j = 0; j < n; j++) {
            printf ("Card %2d:  ", ++r);
            PRINT (i+1);
            for (k = 0; k < n; k++) {
                PRINT (n+1 + n*k + (i*k+j)%n); // Good for n = prime number
            }
            printf ("\n");
        }
    }
}

Example output with $n = 3$:

Card  1:   1   2   3   4
Card  2:   1   5   6   7
Card  3:   1   8   9  10
Card  4:   1  11  12  13
Card  5:   2   5   8  11
Card  6:   2   6   9  12
Card  7:   2   7  10  13
Card  8:   3   5   9  13
Card  9:   3   6  10  11
Card 10:   3   7   8  12
Card 11:   4   5  10  12
Card 12:   4   6   8  13
Card 13:   4   7   9  11