Git Product home page Git Product logo

setsolver's Introduction

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.

setsolver's People

Contributors

akjohnson avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.