new_wordler {wordler} | R Documentation |
Constructs a new object of class "wordler"
Description
Returns a "wordler" object which holds the state of a wordler game as
guesses are made. The returned object will have a target word which is
selected from the default list unless provided in the target
argument.
Usage
new_wordler(
target = sample(wordler::wordle_answers, 1),
game_over = FALSE,
game_won = FALSE,
guess_count = 0,
guess = lapply(1:6, function(x) unlist(strsplit("_____", ""))),
assess = lapply(1:6, function(x) rep("not_in_word", 5)),
keyboard = wordler::keyboards$qwerty,
letters_known_not_in_word = character(0),
letters_known_in_word = character(0),
letters_known_in_position = character(0)
)
Arguments
target |
the target word for the game. Defaults to a random selection from words used by the WORDLE game online (?wordler::wordle_answers) if not provided. |
game_over |
a logical indicating if the game is over. Defaults to FALSE. |
game_won |
a logical indicating if the game has been won. In other words, has the target word been correctly guessed. |
guess_count |
an integer representing the number of guesses made so far. Defaults to 0. |
guess |
a list (of length 6) of character vectors (each of length 5)
representing the guesses of the target word. Each element of the list
represents one of six guesses allowed. Each guess defaults to
|
assess |
a list (of length 6) of character vectors (each of length 5) representing an assessment of each letter in each guess. |
keyboard |
a list (of length 3) of character vectors each representing
a row of a keyboard layout used to visualise the game by |
letters_known_not_in_word |
a character vector of letters known not to be in the target word. |
letters_known_in_word |
a character vector of letters know to be in the target word. |
letters_known_in_position |
a character vector of letters known to be in the correct position in the target word. |
Details
The wordler object is a list which has the following elements:
-
target
- The target word. -
game_over
- A logical indicating if the game is over. Set toTRUE
if either the word is correctly guessed, or all guesses are used. -
game_won
- A logical indicating if the game has been won (target word correctly guessed). -
guess_count
- The number of guesses made so far. -
guess
- A list of guesses of the target word. -
assess
- A list of assessments of the target word. Note that this represents how the letters in each guess should be displayed when printing the game. -
keyboard
- A list representing the keyboard layout to be used when printing the game state. -
letters_known_not_in_word
- A vector of letters known not to be in the target word based on guesses made so far. -
letters_known_in_word
- A vector of letters known to be in the target word based on guesses made so far. -
letters_known_not_in_word
- A vector of letters known to be in the right position in the target word based on guesses made so far.
Value
An object of class "wordler".