3 releases (breaking)
0.3.1 | Dec 23, 2020 |
---|---|
0.2.2 | Dec 6, 2020 |
0.1.1 | Nov 25, 2020 |
0.1.0 |
|
#2413 in Algorithms
110KB
2.5K
SLoC
Wordfeud Solver
A Rust library to evaluate all possible moves given a wordfeud board and rack. The wordfeud solver needs a wordlist to be able to play in a given language. There are no wordlists included with this library. You can get a dutch wordlist here.
This solver is ported from the excellent wordfeudplayer Python package . By porting it to Rust it became much faster.
lib.rs
:
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);
Dependencies
~2–2.8MB
~62K SLoC