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 c("_", "_", "_", "_", "_") to represent a guess not yet made.

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 print(). Defaults to QWERTY layout.

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:

Value

An object of class "wordler".


[Package wordler version 0.3.1 Index]