Skip to content

A program to calculate all possible games in Scrabble, along with their point value

License

Notifications You must be signed in to change notification settings

AnthonyCxx/scrabble-move-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scrabble-move-calculator

Why this library?

This library uses a trie and combinatorics to lowest memory footprint possible

Future Plans

  • Add support for wildcards
  • Add support for non-ASCII Scrabble

Examples

Creating a dictionary

//Default wordlist 
let mut default_dict = ScrabbleMoveCalculator::new();

//Load a dictionary from a wordlist (can return io::Result<Self>)
let dict = ScrabbleMoveCalculator::load_from_file("src/smc/twl06.txt")
           .expect("could not find file!");

Add words to a dictionary

//Add a single word to the dictionary
default_dict.add("practice");

//Add a list of words to the dictionary
default_dict.add_from_file("src/smc/twl06.txt")
            .expect("could not find dictionary");

Checking the amount of points a word is worth

let points = ScrabbleMoveCalculator::calculate_points("hello");
println!("hello is worth {} points", points); 

Checking if a word is playable

if dict.contains("hello") {
        println!("hello is legal!");
    } else {
        println!("hello is not legal!");
}

Generating all possible plays

for (word, points) in dict.generate_plays("setamep") {
        println!("{}: {}", points, word);
}

About

A program to calculate all possible games in Scrabble, along with their point value

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages