Skip to content

jerus-org/wpsr

Repository files navigation

wpsr - Word Puzzle Solver

Crates.io MIT licensed Build Status Rust 1.81+ Docs BuyMeaCoffee GitHubSponsors

Word Puzzle Solver (WPSR) is a command line program to solve the word puzzles.

Installation

Download the source from the git repository and build it with Cargo:

$ git clone https://github.com/jerus-org/wpsr-rs.git
$ cd wpsr-rs
$ cargo build --release

Run from the the command line in the project directory for access to the the dictionary words.

Alternatively, build a bundle with cargo bundle to install and make the dictionary files available from any directory.

$ cargo bundle --release

Usage

There are four subcommands:

  • alpha - Parse list of words to exclude duplicates and non-alphabetic characters
  • list - List available word lists
  • anagram - Find words that are anagrams of a given letter string
  • boxed - Boxed word puzzle tools
  • words - Generate words from a string of letters

alpha is a utility to parse a list of words to exclude duplicates and non-alphabetic characters to create a word list file for use in solving word puzzles.

anagram - Find words that are anagrams of a given letter string. This tool finds single words that can be made using all of the letters contained in the given string (presumed to be a word).

list lists the available word lists default or specified directory.

words generates words generates words as solutions for puzzles based on a limited selection of letters.

boxed provides tools to solve and generate puzzles based on the Letters Boxed puzzle. It offers a generator to generate puzzles and solves boxes with between 3 and 8 edges (each of with 3 letters).

$ wpsr --help
Command line program to help solve word puzzles

Usage: wpsr [OPTIONS] <COMMAND>

Commands:
  alpha    Parse list of words to exclude duplicates and non-alphabetic characters
  list     List available word lists
  anagram  Find words that are anagrams of a given letter string
  boxed    Boxed word puzzle tools
  words    Generate words from a string of letters
  help     Print this message or the help of the given subcommand(s)

Options:
  -v, --verbose...  Increase logging verbosity
  -q, --quiet...    Decrease logging verbosity
  -h, --help        Print help
  -V, --version     Print version

boxed

The boxed sub-command provides tools to solve and generate puzzles based on the Letters Boxed puzzle.

Letters Boxed is a word puzzle in which the player is presented with a shape with three letters on each edge of the shape. The puzzle is solved by connecting letters from alternating edges to form a chain of words, each next word starting with the last letter of the previous word. The words must be valid English words and must be at least 3 letters long. The words must also be words that can be found in the dictionary.

It offers a generator to generate puzzles and solves shapes with between 3 and 8 edges (each of with 3 letters).

  • prepare - Prepare word list
  • solutions - Report multiple solutions for the puzzle
  • solve - Solve word puzzle
  • generate - Generate random letter string for puzzle

prepare massages the word dictionary to prepare it specifically for solving this type of puzzle by eliminating any word that contains a double letter (such as letter) and eliminating words that are shorter than a minimum length (default 3).

solve find the shortest solution for the puzzle string comprising of the minimum number of words required to meet the puzzle criteria.

solutions generate multiple solutions for the same puzzle string.

generate will generate a random letter string for a puzzle of any shape from triangle to octagon. Three letters will be selected randomly for each edge of the shape chosen resulting in a string of between 9 and 24 letters.

$ wpsr boxed -h
Boxed word puzzle tools

Usage: wpsr boxed [OPTIONS] <COMMAND>

Commands:
  generate   Generate random letter string for puzzle
  prepare    Prepare word list
  solutions  Report multiple solutions for the puzzle
  solve      Solve word puzzle
  help       Print this message or the help of the given subcommand(s)

Options:
  -v, --verbose...  Increase logging verbosity
  -q, --quiet...    Decrease logging verbosity
  -h, --help        Print help
  -V, --version     Print version