wordle-cli

Crates.iowordle-cli
lib.rswordle-cli
version1.0.1
sourcesrc
created_at2022-06-15 22:44:51.491167
updated_at2022-06-16 16:13:43.721187
descriptionThe popular word guessing game as CLI application! Written in Rust.
homepagehttps://www.tohuwabohu.io/projects/wordle-cli
repositoryhttps://github.com/tohuwabohu-io/wordle-cli
max_upload_size
id606781
size261,408
Stefan Poindl (tohuwabohu-io)

documentation

https://www.tohuwabohu.io/projects/wordle-cli

README

wordle-cli

crates.io .github/workflows/build.yml .github/workflows/test.yml

wordle-cli is a wordle inspired word guessing game for the CLI written in rust.

Usage

Run the game by executing cargo run [language].

If language is not set, it defaults to "en".

Run the import tool by executing cargo run --bin import <source-file> <import-language>.

Game rules

The player has to correctly guess a randomly selected word from the dictionary. All words are 5 characters long. By coloring single letters the game tells the player about correct letter positioning.

  • green: The guessed letter is at the correct position.
  • orange: The word contains the letter, but at a different position.

The game ends when the player runs out of guesses or when the player guesses the word correctly. After that, a message is displayed.

Settings

The .env file contains information about the database location.

  • DATABASE_URL indicates that the dictionary is located in a given db url

Import

The import tool can be used to expand the word base. Usage: See Usage above.

However, the requirements for the file underneath the <file_path> argument are as follows:

  • The file needs to be encoded in UTF-8
  • The words need to be separated with a newline character as the file is read line-wise

The tool automatically removes duplicates and entries with a size different from 5 characters and converts unicode characters to ASCII using any_ascii. German umlauts receive a special treatment.

Database

If you choose to set up a database to serve as dictionary, please take a closer look at the diesel.rs documentation. You need a working diesel_cli installation to proceed.

Step 1: Run the diesel initialization.

diesel setup

Step 2: Create a diesel migration.

diesel create dictionary_migration

Step 3: Navigate to the res/db folder.

create.sql and drop.sql should be put into the diesel migration's up.sql and down.sql. Those files are excluded from the crate.

Step 4: Import your dictionary into the database.

cargo run -- import --source-file=dictionary.txt --import-language=en

Et voilĂ ! Enjoy additional features. A correctly guessed word will be marked as guessed in the database and won't show up a second time. The first randomly selected word of the day will re-occur upon starting the game on the same day, until it has been guessed successfully.

Commit count: 51

cargo fmt