Skip to main content

A Python command line application for generating Rush Hour puzzle cards.

Project description

Rush Cards

Sample Rush Cards puzzle

Rush Cards provides a Python command line application for generating puzzle cards for the game Rush Hour. It builds on a project by Michael Fogleman to identify all possible Rush Hour puzzles. Put simply, this project takes that database of puzzles, keeps the puzzles that can be expressed in the standard board game, maps a 1-10 difficulty scale onto them, and provides an interface to generate endless puzzle cards.

Installation

Make sure you have Python installed. Then run:

$ pip install rushcards

Usage

Cards are generated from the command line using either rushcards or python -m rushcards.

$ rushcards 5

This will generate a single card representing a random puzzle of difficulty 5, save the PNG image to a temporary directory, then open it in a native image-viewing application.

In addition to numbers 1 through 10 you can also specify _ (underscore) to choose a random difficulty.

To put multiple cards into the same image use a comma-separated list of difficulties.

$ # Create a single image with 6 puzzles in a 2x3 layout.
$ rushcards 2,_,4,5,6,10

A compact layout will be chosen automatically, but you can also specify the layout with the --layout option.

$ # Create an image with 6 rows of 1 puzzle each.
$ rushcards 2,_,4,5,6,10 --layout 6x1

Regardless of how the layout is chosen, enough puzzles will be generated to completely fill it. This is done by repeating the sequence of difficulties as many times as necessary.

$ # Create an image with 8 puzzles alternating between difficulties 2 and 3.
$ rushcards 2,3 --layout 2x4

Use the --outfile option to specify an output file.

$ # Save the image to a file.
$ rushcards 5 --outfile puzzle.png

Specify the file as - (hyphen) to output to stdout.

$ # Send the image to stdout and pipe it to another program.
$ rushcards 5 --outfile - | wc -c
7987

Note that when writing to stdout the image can't be opened automatically. You can also manually suppress opening the file with the --no-open option.

$ # Write the puzzle to a file but don't open it.
$ rushcards 5 --outfile puzzle.png --no-open

Notes

The puzzle cards do not show solutions. The puzzle database doesn't include them, and in any case they aren't really necessary to enjoy the game.

The pixel size of the PNG image is fixed to a fairly arbitrary value since image viewing applications all have the ability to scale as needed for viewing or printing.

This package also includes the mkpuzzles tool (invoked with python -m rushcards.tools.mkpuzzles). This was used to filter the original Rush Hour puzzle database, assign difficulties, and save the data for later use with the rushcards application.

In total the program can generate 443,266 distinct puzzles.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rushcards-0.2.0.tar.gz (5.6 MB view details)

Uploaded Source

Built Distribution

rushcards-0.2.0-py3-none-any.whl (5.7 MB view details)

Uploaded Python 3

File details

Details for the file rushcards-0.2.0.tar.gz.

File metadata

  • Download URL: rushcards-0.2.0.tar.gz
  • Upload date:
  • Size: 5.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.0

File hashes

Hashes for rushcards-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6abb9eab6b8cc4ed9d3dfa3149fb0fe4574b89a0025daec5e2477eff2049f2b0
MD5 d69fef8ec4eacb2276b318c1cd760542
BLAKE2b-256 acd508a6c654c25af2a0fd6f4a2295b5ce91eed6123f88fc732431847c5ca47d

See more details on using hashes here.

File details

Details for the file rushcards-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: rushcards-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.0

File hashes

Hashes for rushcards-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1fb3b9e4e8a12c1067deae91c63f6594be393280bc977dcc7bb2d19cc8c665ff
MD5 c9e5be71fd98f97b376188fd9b76da55
BLAKE2b-256 084067085453f7302bdb24ea97b81bebf395a972318b483f462bb46f0510b2be

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page