Skip to content

akjohnson/setsolver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Game of Set

Set is a simple puzzle game consisting of making sets out of cards with different symbols on them.

Each card in the game has a symbol with a set of features: color, shape, number of objects, fill. A group of cards is considered a "set" if every feature taken across the cards is either the same on each card or different on each card.

This program is a generalized version of the rules of the game:

  • The deck can be any number of cards.
  • Sets do not have to be a size of 3, although if you specify a set size larger than the number of features only identical cards will be capable of being sets.
  • The cards can have any sort of features and any number of features, not just the ones in the game, and the features can have any number of values.

The classical features of the original game are:

  • Color: red, green, purple
  • Number of symbols: one, two, three
  • Shape of symbol(s): oval, squiggle, diamond
  • Shading: solid, open, striped

Running

setsolver.py takes in a file listing the cards and their characteristics, and prints out the set groups present.

Card files can have comment lines that start with "#", which are disregarded.

The first non-comment line should be the list of properties, separated by tabs. Then, one card per line, like this:

Red	3	Diamond	Striped

Fields are separated by tabs. The descriptors can be anything as long as you use them consistently. The features don't need to be in a particular order for the program to work, but each line needs to have the same feature in the same position.

There are three example files. Example usage involving one of them:

python set_solver.py -i examples/example.set

Testing

If you're in the code directory, you can run all the tests with:

python test.py 

Test files are found in the test directory. They start with a comment line that looks like:

# 0-3-4|1-6-9|2-3-8|4-5-8

That indicates what sets should be found in this deck. Note: since that can depend on the number of features given to make a set, some of the files are duplicated with only the expected sets line changed.

About

A python script/module that solves generalized Set games

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages