| Crates.io | boggle-maker |
| lib.rs | boggle-maker |
| version | 0.1.4 |
| created_at | 2025-04-08 21:22:15.539825+00 |
| updated_at | 2025-04-21 21:54:42.822318+00 |
| description | Rust tools for Boggle enthusiasts: board generation and analysis. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1625966 |
| size | 2,770,529 |
boggle-maker: Rust tools for Boggle enthusiasts: board generation and analysis.This crate implements genetic algorithms for Boggle board generation as part of my ongoing Rust language learning journey. Expect continuous improvements to code quality and data structure design.
boggle-makerTo use boggle-maker, add the following to your Cargo.toml file:
[dependencies]
boggle-maker = "0.1.3"
let builder = BoggleBuilder::new()
.with_dictionary_path("word-list.txt")
.with_target_score(3000)
.with_length(4)
.with_width(4);
if let Some(board) = builder.build().expect("Failed to load trie from word-list.txt file") {
println!("This is a generated board by boggle-maker:");
println!("{:?}", board.hash().to_ascii_uppercase());
println!("Total score: {}", board.score().unwrap());
}
let solver = BoggleBoardSolver::new()
.with_dictionary("word-list.txt");
assert!(solver.is_ok(), "Failed to load trie from word-list.txt file");
let solver = solver.unwrap();
let board = vec!['S','E','R','S','P','A','T','G','L','I','N','E','S','E','R','S'];
let result = solver.solve_vec(&board, 4, 4).unwrap();
let three_count = result.how_many(3);
println!("There are {three_count} words with score equal to 3");
let solver = BoggleBoardSolver::new()
.with_dictionary("word-list.txt");
assert!(solver.is_ok(), "Failed to load trie from word-list.txt file");
let solver = solver.unwrap();
let board = BoggleBuilder::new()
.with_dictionary_path("word-list.txt")
.with_target_score(3000)
.with_length(4)
.with_width(4)
.build()
.unwrap();
assert!(board.is_some());
let board = board.unwrap();
let result = solver.solve(&board).unwrap();
let three_count = result.how_many(3);
println!("There are {three_count} words with score equal to 3");