filter_game: Filter dictionary of target words using Wordle logic

View source: R/filter_dictionary.R

filter_gameR Documentation

Filter dictionary of target words using Wordle logic

Description

Restrict original dictionary of possible words to those that meet criteria based on information about letters that are correct, incorrect, or misplaced in the unknown target word.

Usage

filter_game(guesses, target, dict = NULL, hide = TRUE)

Arguments

guesses

vector of character indicating sequential guesses

target

Word to use as comparison to guess to determine which letters are correct, incorrect, or misplaced.

dict

Vector of strings of possible words to match. If NULL, uses dictionary as default.

hide

If TRUE, return number of words remaining after filtering. If FALSE, return vector of remaining words themselves.

Value

List of either a vector of words remaining after filtering or integer indicating the number of words remaining.

Examples

target <- "panic"
guess <- c("burst", "canoe")

filter_game(dict = dictionary, guess, target)

robe2037/wordle documentation built on March 2, 2023, 2:18 a.m.