[−][src]Crate wordfeud_solver
A wordfeud library for Rust.
This crate allows you to calculate the best scores in a game of wordfeud.
It can be used to study strategies in the game, or just to cheat.
This library is a Rust port of the excellent wordfeudplayer
python library.
It can use the rayon
crate to calculate moves in parallel.
The time required to evaluate a board is in the order of 1 millisecond.
How to use wordfeud_solver
Start by creating a wordfeud board, then specify the wordlist to be used, and the tiles on the board.
By default a standard board is used, but you can specify your own "random" board.
The wordlist must be in utf-8 and contain one word per line.
Several wordfeud wordlists are available on the internet.
A wordlist for the dutch language is available here.
It is based on the OpenTaal
wordlist, with modifications by the author.
Basic usage
let mut board = Board::default().with_wordlist_from_words(&["rust", "rest"])?; let results = board.calc_all_word_scores("rusta")?; assert_eq!(results.len(),8); for (x,y,horizontal,word,score) in results { println!("{} {} {} {} {}", x, y, horizontal, board.decode(word), score); } board.play_word("rust", 7, 7, true, true)?; println!("{}", board);
Structs
Board | Represents the state of a |
Cell | A cell on the board that is either empty or contains a |
Codec | Translate from string to label codes and vice versa. Each wordfeud tile is translated to a code. |
ItemList | A wrapper around a list of |
Letter | A letter that can be used as |
Tile | A tile on the board, either a regular letter or a wildcard (blank used as letter) |
Wordlist | A trie data structure that holds all the possible words. |
Enums
Error | Errors that can be returned |
Language | These languages are supported. |
Traits
Item | |
List | common trait for a list of |
Type Definitions
Code | Tile code used to represent |
Label | Code 1..31 for valid letter in wordlist (a..z plus language specific) |
Letters | A collection of |
Row | A collection of |
RowData | A list of 0..N (possible letters, connected) tuples. |
Word | A collection of |