1 unstable release

0.1.0 Mar 18, 2022

#1492 in Text processing

MIT license

38KB
980 lines

crustword - Crusty Crosswords

image

Features

  • Solves crosswords
  • Generates random crosswords from a word list
  • Nice crossword output
  • Supports all kinds of languages
  • Spectator mode

Usage

cargo install crustword
crustword help

Rules

In this kind of crossword, a grid of arbitrary size is filled with characters and the goal is to find all words in it from a specific list of words.

Consider this crossword:

Q C R O S S W O R D S
C R U S T Y E R T I O
P U A S D F G H J K L
Z S X C V E N M Q W E
R T T U I O L A S D F
G W H J K L Z Z C V B
N O M Q W E R T Z U I
O R P A S D F G H U K
L D Z X C V B N M Q P
  • CRUSTWORD
  • CRUSTY
  • CROSSWORDS
  • PUZZLE

Here is the solution with the relevant letters written in lowercase for distinction:

Q c r o s s w o r d s
c r u s t y E R T I O
P u A S D F G H J K L
Z s X C V e N M Q W E
R t T U I O l A S D F
G w H J K L Z z C V B
N o M Q W E R T z U I
O r P A S D F G H u K
L d Z X C V B N M Q pā€‹

Words can be written in all eight directions: the four cardinal directions and the four ordinal directions.

You can find this crossword in crosswords/: crosswords/crustword/

Input format

First comes a grid of characters with an arbitrary width and height. Examples:

  • aaa
    aaa
    aaa
    
  • a a a
    a a a
    a a a
    
  • a   a   a
    
    a   a   a
    
    a   a   a
    

etc. The grid is very flexible and these are all the same.

On the last line comes a list of all words to be found in this grid separated by any amount of whitespace. Examples:

  • house tree shop
    
  • house  tree  shop
    
  • house   tree   shop
    

etc. These are all the same.

Here is a full example:

AsAAt
AhAAr
house
ApAAe

house tree shop

Note that the matching algorithm is case-sensitive and "Word" does not match "word".

You can use any characters. See crosswords/lang/ for crosswords written in various languages.

Dependencies

~1.5MB
~24K SLoC