Crates.io | wordle_rs |
lib.rs | wordle_rs |
version | 0.2.0 |
source | src |
created_at | 2022-01-24 18:00:51.941574 |
updated_at | 2022-02-06 15:45:08.490082 |
description | Tools to build and test Wordle strategies |
homepage | |
repository | https://github.com/cgm616/wordle_rs/ |
max_upload_size | |
id | 520332 |
size | 243,577 |
wordle_rs
WARNING: this project is still unstable, so minor updates may break backwards incompatibility.
Have you ever gotten so obsessed with Wordle that you wanted to evaluate different strategies programmatically? If so, you're in the right place.
This crate is a part of the wordle_rs
project, which has three parts:
wordle_rs
, a library with tools you can use to write and evaluate your own Wordle strategies,wordle_strategies
, a library demonstrating a few strategies that I wrote, andwordle_runner
(WIP), a command line program that can run and compare Wordle strategies written with wordle_rs
.Please feel free to contribute your own strategies to wordle_strategies
!
wordle_rs
to write a strategyAdd the following to your Cargo.toml
:
[dependencies]
wordle_rs = "0.2.0"
Then, define a new struct and implement the Strategy
trait for it.
use wordle_rs::Strategy;
struct MyCoolStrategy;
impl Strategy for MyCoolStrategy {
// snip
}
Then, configure and run the test harness on your strategy.
You can see how to do this below.
You can also use wordle_runner
to run your strategy for you, though this is still a work in progress.
wordle_strategies
To run a pre-made strategy (possibly against your own!), first add the following to your Cargo.toml
:
[dependencies]
wordle_rs = "0.2.0"
wordle_strategies = "0.2.0"
Then, import a strategy and run the wordle_rs
test harness on your strategy.
wordle_rs
test harnessSimply import the harness and configure it to run the strategies that you want to test.
You can add strategies from any location, including those that you write yourself.
The Harness::add_strategy
method accepts anything that implements the Strategy
trait.
use wordle_rs::{harness::Harness, WordleError};
use wordle_strategies::Common;
fn main() -> Result<(), WordleError> {
let harness = Harness::new()
.add_strategy(Box::new(Common), None)
.test_num(10);
let perfs = harness.run()?;
perfs.print_report()?;
Ok(())
}
wordle_runner
Forthcoming.
wordle_rs
Examples of how to build your own strategies are available in the
wordle_strategies
folder in this repository, which contains the code for
the crate of the same name.
The wordle_rs
crate supports disabling some non-crucial functionality, allowing it to build without some major dependencies.
Here are the features and their effects:
serde
*: allows serializing and deserializing performance records and includes mechanisms for loading and saving baselinesstats
*: enables statistical comparisons between performance recordsfancy
*: enables fancy display with colors, progress bars, and tablesparallel
*: allows running the test harness in parallel*: enabled by default
Everything in this project is licensed under the MIT license.