Skip to content

Python code for generating png files of given number sets. This lets you create your own dooble game

Notifications You must be signed in to change notification settings

georghildebrand/ProjectiveGeometry-Game

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Background

At one of these afternoons we were together with the family and someone had this children card game "Dobble". After playing it for a while there was the idea that it would be an amazing idea to have the game with personalized pictures as christmas present. So I went to the web and quickly found an related question on stackoverflow, with a nice python example implementation already on github.

The game:

  • On each card are O 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)
  • You can produce a deck of N cards with N images. N must be prime so there is an order O (also prime number) that satisfies: N = O² + O + 1. Eg if you want to have a deck with 30+ images you have to have 31 images and 5 images per card. 31 = 5² + 5 +1. So take care, the more cards you need the more images you need to have.

Number of Images and Cards:

You can produce a deck of N cards witch requires a number of N images as well. The order O of the system needs to be a prime! On the cards you can place O + 1 images. O must be prime so the total number of cards is: N = O² + O + 1 . Eg if you want to have a deck with 30+ images you have to have 31 images and 5 images per card. 31 = 5² + 5 +1. So you will also get 31 images.

How to run:

Place 31 images in "input_images"

Requirements:

You need the pillow package installed

pip install pillow

Than run:

python create_cards.py -d input_images_directory -o out_images_directory -O number_of_images_per_card

Make sure that the number of images per card matches: N = O² + O + 1 (O: number of images per card, N: number of cards). Otherwise you don't create a finite geometric plane.

You will get images like the examples in out_images like these:

Its tested with python 2.7 and order of 5 --> 31 cards. For other configs it might be neccessary to change the code in draw.py because it may create overlays etc. You will find the cards of the game in the out_images folder.

For those interested in the Geometry behind: https://de.wikipedia.org/wiki/Fano-Ebene Discussion on the combinatorics: link

References:

About

Python code for generating png files of given number sets. This lets you create your own dooble game

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%