Skip to main content

Regex Crossword

License: MIT PyPI pyversions PyPI version fury.io Code style: black

Terminal Freaks rejoice!

Based on the Regex Crossword, this is an implementation written in pure python using only the standard library to play the game offline entirely from your shell.

If you aren't familiar with the concpet of a regex crossword, it's a blank crossword grid that you need to fill so that each row and column will match the specified regex. It's a fun exercise to your regex abilities and an interactive way to learn about them and practice while playing.

I'm a bit of a terminal freak myself and so the moment I started playing the wonderful online version it seemed so natural to me that there needs to be a version of the concept playable from the shell, so I made one using nothing but Python's curses module.

Installation

Use the Python package manager pip to install regex_crossword.

pip install regex_crossword

To install the scraper functionality as well (more on this below) use:

pip install regex_crossword[scraper]

Note: the scraper uses the Selenium 3rd party package that might need extra setup to be used (specifically the Chrome WebDriver). If you encounter any problems I advise you to check out their installation guide.

Usage

Once installed in your environment, simply type regex_crossword from your terminal and start playing!

Loading level packs

When the game starts it will attempt to load "level packs" for it to use. It looks for them in the following places in descending order:

  1. First, it will look wherever the --level-packs option was pointing when invoking the game command (for a full list of all commands use the -h or --help flag).
  2. If no option was specified, it will look wherever the REGEXCW_LEVEL_PACKS environment variable is pointing, if it exists.
  3. Lastly and by default, it will search for a directory called level_packs in the current working directory.

If all of this fails (or the directory has no packs), an error will pop up informing you no level packs were found.

Getting level packs

When trying to get level packs you have several options:

  • Use the --scrape flag (this requires you to install the scraper extra). This will scrape some online resources and create level packs based on them for you to load into the offline version.
  • Create your own level packs!

Creating your own level packs

Level packs are simply JSON files who follow this format:

[
    {
        "title": "Beatles",
        "up_to_down": [
            "[^SPEAK]+",
            "EP|IP|EF"
        ],
        "left_to_right": [
            "HE|LL|O+",
            "[PLEASE]+"
        ],
    },
    {
        "title": "Pisco Sour",
        "up_to_down": [
            "(MA|LM)",
            "[^MESH]+"
        ],
        "left_to_right": [
            "[LINE]+",
            "[LAM]+"
        ],
        "right_to_left": [
            "[ISLE]+",
            "[MALE]+"
        ],
        "down_to_up": [
            "[LAME]*",
            "[^LES]+"
        ]
    },
]

The main file json is a list of smaller dictionaries who each implement a "level" format:

  • title - the title of the level.
  • up_to_down - the regexes who will attempt to match the columns from top to bottom (specified from left to right)
  • left_to_right - the regexes who will attempt to match the rows from left to right (specified from top to bottom)
  • down_to_up - same as up_to_down but will attempt to match the columns from bottom to top.
  • right_to_left - same as left_to_right but will attempt to match the rows from right to left.

License

MIT

Release files for regex-crossword 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for regex-crossword 0.1.0
File Size Uploaded
regex_crossword-0.1.0.tar.gz 13.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for regex-crossword 0.1.0
File Interpreter ABI Platform
regex_crossword-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.8 kB

Release files / regex_crossword-0.1.0.tar.gz

Download URL regex_crossword-0.1.0.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
12a64b5e0f1a2a78793707d8fb65184be6908f5c8b81f3602925892dfaa761ba
BLAKE2b-256 checksum
How to use checksums
6c8c9ad49310099099c5ecb5d70a39f66161a9eea9d0699b226c442bb3f48cab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.6.8

Release files / regex_crossword-0.1.0-py3-none-any.whl

Download URL regex_crossword-0.1.0-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3687eb3040de38920fa95139b0811038caf83aa176900c2ec59c0beb68e61848
BLAKE2b-256 checksum
How to use checksums
a35b884afcb245013b80fad21368593f1a65046b6c6e0d5900ce63a935103280
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.6.8

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page