[][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 s in results {
      println!("{} {} {} {} {}", s.x, s.y, s.horizontal, board.decode(s.word), s.score);
}
board.play_word("rust", 7, 7, true, true)?;
println!("{}", board);

Structs

BestScore

Returned score information. Extended from board::Score

Board

Represents the state of a wordfeud board.

Cell

A cell on the board that is either empty or contains a Tile

Codec

Translate from string to label codes and vice versa. Each wordfeud tile is translated to a code.

Grid

Wordfeud board grid, consisting of 15x15 (normal or bonus) squares.

ItemList

A wrapper around a list of Item. Used to represent Word, Letters and Row.

Letter

A letter that can be used as Tile on the board.

Score

Score returned by calc_all_word_scores

Tile

A tile on the board, either a regular letter or a wildcard (blank used as letter)

TileSet

A tileset for wordfeud. It contains the tile distribution for a supported language, and a codec to translate between words and tiles. The tile distributions are specified on the Wordfeud.com website

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

common trait for Tile, Letter, Cell

List

common trait for a list of Item

Functions

find_best_scores

Find the best moves on a wordfeud board, considering opponent moves.

Type Definitions

Code

Tile code used to represent Tile or Letter. See Codec.

Label

Code 1..31 for valid letter in wordlist (a..z plus language specific)

Letters

A collection of Letter.

Row

A collection of Cell.

RowData

A list of 0..N (possible letters, connected) tuples.

Word

A collection of Tile.