From 813fff8647ea67f3c41130baf6a4c518e2a872c5 Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Wed, 7 Aug 2024 13:01:35 +0000 Subject: [PATCH 1/3] automatic cargo CI changes --- src/solve/naive/mod.rs | 2 +- tests/solver.rs | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/solve/naive/mod.rs b/src/solve/naive/mod.rs index f3d94a2..7d72f33 100644 --- a/src/solve/naive/mod.rs +++ b/src/solve/naive/mod.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; use libpt::log::{debug, error, info, trace}; use crate::error::{SolverError, WResult}; -use crate::game::evaluation::{Evaluation}; +use crate::game::evaluation::Evaluation; use crate::wlist::word::{Word, WordData}; use crate::wlist::WordList; diff --git a/tests/solver.rs b/tests/solver.rs index 86eaa43..2b9ef82 100644 --- a/tests/solver.rs +++ b/tests/solver.rs @@ -1,10 +1,7 @@ use test_log::test; // set the log level with an envvar: `RUST_LOG=trace cargo test` -use wordle_analyzer::game::evaluation::Evaluation; -use wordle_analyzer::game::Game; use wordle_analyzer::solve::{AnyBuiltinSolver, NaiveSolver, Solver, StupidSolver}; use wordle_analyzer::wlist::builtin::BuiltinWList; -use wordle_analyzer::wlist::word::{Word, WordData}; use wordle_analyzer::wlist::WordList; fn wordlist() -> impl WordList { From 7644970d1f509138eb170a9306578ad9606c3a54 Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Wed, 7 Aug 2024 15:07:59 +0200 Subject: [PATCH 2/3] docs(readme): make wordlist attributions clearer --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6039a95..3fe839c 100644 --- a/README.md +++ b/README.md @@ -26,5 +26,6 @@ have to guess words by slowly guessing the letters contained in it. Included in this repository are the following wordlists: -* [3Blue1Brown Top English words](./data/wordlists/german_SUBTLEX-DE.json) --- [`./data/wordlists/en_US_3b1b_freq_map.json`](https://github.com/3b1b/videos/tree/master/_2022/wordle/data) -* [~33.000 Common German Words](./data/wordlists/german_SUBTLEX-DE.json) --- [SUBTLEX-DE](https://osf.io/py9ba/files/osfstorage) +* [`./data/wordlists/en_US_3b1b_freq_map.json`](./data/wordlists/en_US_3b1b_freq_map.json) --- [3Blue1Brown Top English words](https://github.com/3b1b/videos/tree/master/_2022/wordle/data) +* [`./data/wordlists/german_SUBTLEX-DE_full.json`](./data/wordlists/german_SUBTLEX-DE_full.json) --- [SUBTLEX-DE ~33.000 Common German Words](https://osf.io/py9ba/files/osfstorage) +* [`./data/wordlists/german_SUBTLEX-DE_small.json`](./data/wordlists/german_SUBTLEX-DE_small.json) --- [SUBTLEX-DE ~33.000 Common German Words (reduced to most common)](https://osf.io/py9ba/files/osfstorage) From c7b068ef31499d6e8aed4784129b02250a2bc6fa Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Wed, 7 Aug 2024 22:10:17 +0200 Subject: [PATCH 3/3] feat(bench): move benching to actual benches, primitively --- Cargo.toml | 8 ++++++++ benches/solver_naive.rs | 18 ++++++++++++++++++ benches/solver_stupid.rs | 19 +++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 benches/solver_naive.rs create mode 100644 benches/solver_stupid.rs diff --git a/Cargo.toml b/Cargo.toml index fd6f28a..4b374b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -64,3 +64,11 @@ test-log = { version = "0.2.16", default-features = false, features = [ "color", "trace", ] } + +[[bench]] +name = "solver_naive" +harness = false + +[[bench]] +name = "solver_stupid" +harness = false diff --git a/benches/solver_naive.rs b/benches/solver_naive.rs new file mode 100644 index 0000000..f850b62 --- /dev/null +++ b/benches/solver_naive.rs @@ -0,0 +1,18 @@ +use wordle_analyzer::bench::builtin::BuiltinBenchmark; +use wordle_analyzer::bench::Benchmark; +use wordle_analyzer::game::{self, GameBuilder}; +use wordle_analyzer::solve::{NaiveSolver, Solver}; +use wordle_analyzer::wlist::builtin::BuiltinWList; + +fn main() -> anyhow::Result<()> { + let wl = BuiltinWList::english(5); + let builder: GameBuilder<'_, BuiltinWList> = game::Game::builder(&wl) + .length(5) + .max_steps(6) + .precompute(true); + let solver: NaiveSolver<_> = NaiveSolver::build(&wl)?; + let bench = BuiltinBenchmark::build(&wl, solver, builder, 16)?; + bench.start(2000, &bench.builder())?; + println!("{}", bench.report()); + Ok(()) +} diff --git a/benches/solver_stupid.rs b/benches/solver_stupid.rs new file mode 100644 index 0000000..1fadbd8 --- /dev/null +++ b/benches/solver_stupid.rs @@ -0,0 +1,19 @@ +use wordle_analyzer::bench::builtin::BuiltinBenchmark; +use wordle_analyzer::bench::Benchmark; +use wordle_analyzer::game::{self, GameBuilder}; +use wordle_analyzer::solve::Solver; +use wordle_analyzer::solve::StupidSolver; +use wordle_analyzer::wlist::builtin::BuiltinWList; + +fn main() -> anyhow::Result<()> { + let wl = BuiltinWList::english(5); + let builder: GameBuilder<'_, BuiltinWList> = game::Game::builder(&wl) + .length(5) + .max_steps(6) + .precompute(true); + let solver: StupidSolver<_> = StupidSolver::build(&wl)?; + let bench = BuiltinBenchmark::build(&wl, solver, builder, 16)?; + bench.start(2000, &bench.builder())?; + println!("{}", bench.report()); + Ok(()) +}