xwords

xwords is a fast library that fills crossword puzzles. This repo also contains a lightweight CLI for invoking the library.

Caveat Emptor

This is foremost a hobbyist project for me to learn a bit about profiling and optimizing rust. I am more than happy to accept contributions or to consider feature requests, but please be aware that the future of this project is somewhat uncertain.

CLI

This command fills a grid that is stored in a local file using a default wordlist.

```bash $ xwords --input grids/20201005_empty.txt

CFSANGELIORDU AIADEEPASSEIN SCLAVONIANMFAS IKANTLETGOALLE OLDYROEANOSE *YOOHOOMRSBLOOM *FUGUEIRIDAL FAALISECOSPY IMPROVACOOK* BILLIEJEANKING* SEUSSIADCEIL STTICALKALI CITICACOMISTLE CORNOMOLONLIS CLEENATURAYST ``` This command runs in about 2 seconds on my machine.

Library

```rust use xwords::{crossword::Crossword, fillcrosswordwithdefaultwordlist};

fn main() -> Result<(), String> { let emptycrossword = Crossword::new(String::from( " * *
* *
*
* * *
** *
* * * *
* *
* *
*
*
* ** * * *
*
* *
* *
", ))?; let filled
crossword = fillcrosswordwithdefaultwordlist(&emptycrossword)?; println!("{}", filledcrossword); Ok(()) }

/* ZETATWITVOWEL ETATIANAEVOKE RINTINTINREVIE OCTTIETUIENR ATHATASTINGS TOLEANILIES ISIACTEANSTEM ZATACHATESHRA AYESSETETYEES TUTSIURALIC VENERATESEWA ORATROUESTOA WISHINETASSETS ETHICEVILUSTO RUEDASWALOTSU */ ``` On my machine, the above snippet runs in about 3 seconds.

Behind the scenes, this snippet loads an indexed wordlist, and iteratively fills the input with valid words.