Learn R Programming

lares (version 5.1.0)

wordle_check: Wordle Game Validation

Description

Given and input and a word, validate each letter based on Wordle's rules: correct letter in correct placement (green), correct letter in wrong placement (yellow), letter is not present (red).

Usage

wordle_check(
  input,
  word,
  dictionary = NULL,
  lang_dic = "en",
  method = 3,
  print = TRUE
)

wordle_dictionary(lang_dic = "en", method = 3, quiet = TRUE)

wordle_simulation(input, word, seed = NULL, quiet = FALSE, ...)

Arguments

input

Character. Word to validate (5-letters)

word

Character. Word actually answer (5-letters).

dictionary

Character vector. List of valid words. If set to NULL then will use modified scrabble_dictionary() to fetch 5 letter words. Use lang_dic param to set language.

lang_dic

Character. Any of: "en", "es". Only used when dictionary parameter is NULL. Requires internet connection the first time. Uses cache.

method

Integer. 1 for scrabble_dictionary(), 2 for reduced Wordle words from github, 3 for scrapping NYTimes set of words.

print

Boolean. Print validation results?

quiet

Boolean. Do not print words as they are being searched.

seed

Numeric. For reproducibility.

...

Additional parameters passed to lares:::wordle_opts()

Value

Depends on cat: NULL if TRUE or character string if FALSE.

Examples

Run this code
# NOT RUN {
word <- "ABBEY"
# Or pick a random one:
# word <- sample(wordle_dictionary("en"), 1)
wordle_check("OPENS", word)
wordle_check("BABES", word)
wordle_check("BABES", word, print = FALSE)
wordle_check("KEBAB", word)
wordle_check("ABYSS", word)
wordle_check("ABBEY", word)

wordle_simulation(input = "SAINT", word = "ABBEY", seed = 2)
# }

Run the code above in your browser using DataLab