8000 GitHub - natemcintosh/letter_box: Solve the "letter boxed" NYT puzzle game
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

natemcintosh/letter_box

Repository files navigation

letter_box

Author: Nathan McIntosh


About

This rust program produces a binary which solves the NYT Letter Boxed puzzle game.


Compiling and Running

  1. Make sure you have the Rust programing language installed
  2. Clone this repo to a location on your computer: git clone https://github.com/natemcintosh/letter_box.git
  3. Build in release mode: cargo build --release
  4. Run the produced binary asking for help to see all options: ./target/release/letter_box -h
  5. Run the binary on the puzzle inputs for the day, e.g.: ./target/release/letter_box "abc def ghi jkl"

Strategy for solving the puzzle

  1. Create an array of the sides of the box in create_sides(). The keys are integers from 1 to 4. The values are HashSets of the characters on that side.
  2. Read in a file of valid words. A file of words from the American English Dictionary is included.
  3. Determine which words from the list can actually fit into the box by filtering the list with the word_is_valid() function.
  4. With valid_permutations(), iterate through all of the per 5569 mutations (default is length 2 permutations, but can be changed with the -n argument when calling the binary) of valid words.
    • Filter out any that cannot be joined, i.e. the last letter of one word is not the first letter of the next.
    • Filter out any permutations where all of the letters in the box are not used
  5. The remaining permutations are valid solutions to the puzzle. Print them out

About

Solve the "letter boxed" NYT puzzle game

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

0