pub struct Game { /* private fields */ }
Expand description

A Wrapper over State that manages creation and playing of games

Implementations

Create a new game based on the current date (official style)

Create a new game based on the given word

Create a new game based on the given date

Create a new game based on the given day number

Sets the play style of this game to ‘hard mode’. This means that any exact matches found must be re-used in later guesses

Get the GameType for this game

Make a guess.

Errors

If the guess is an invalid word, or if it doesn’t match the requirements of hard mode, this function will return an error

Display the share card for this game

use cl_wordle::game::Game;
let mut game = Game::from_day(0, cl_wordle::words::NYTIMES);
game.guess("crane").unwrap();
game.guess("carts").unwrap();
game.guess("chair").unwrap();
game.guess("cigar").unwrap();

let share = game.share();
let score_card = format!("{}", share);
assert_eq!(score_card, r"Wordle 0 4/6
🟩🟨🟨⬛⬛
🟩🟨🟨⬛⬛
🟩⬛🟨🟨🟩
🟩🟩🟩🟩🟩");

Methods from Deref<Target = State>

Reveal the solution for the current game state

Returns an iterator over the previous guesses

Determine if the game is over.

Displays the score card for this game state to the given fmt::Write.

Trait Implementations

The resulting type after dereferencing.

Dereferences the value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.