knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
Implementation of Wordle in R. Designed primarily for package development practice and for personal Wordle data tracking.
You can install the development version of wordle from GitHub with:
# install.packages("devtools") devtools::install_github("robe2037/wordle")
To play a game of Wordle, use play_wordle()
:
library(wordle) play_wordle()
Simply enter your words into the R console and press [ENTER] to submit them. Submitting an empty line will quit the game and reveal the target word.
By default, play_wordle()
generates a game with 5 letter words, but the game can
also be played with other word lengths. If a length other than 5 letters is specified,
the Scrabble dictionary provided by the words
package is used. Otherwise, the
dictionary used in the actual Wordle game is used.
To explore how the universe of possible words changes with each guess, use filter_guess()
.
This will indicate the number of words remaining when provided with a guessed word and the locations of the incorrect, correct, and misplaced letters in that guess.
filter_guess( guess = "flour", correct = c(1, 5), misplaced = 3, incorrect = c(2, 4), hide = FALSE )
filter_guess()
can also be used with a known target word to automatically determine the locations of the incorrect, correct, and misplaced letters in the guess. Setting hide = FALSE
will show the words that remain rather than the number remaining.
filter_guess( guess = "flock", target = "quack", hide = FALSE )
To get stats for an entire game, use filter_game()
:
filter_game( guesses = c("flock", "crack", "quack"), target = "quack", hide = TRUE )
These functions will also work for games with non-five-letter words, but the user
must specify the dictionary that is being used for comparisons. The words
package
can be used to easily create a dictionary of words of various lengths.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.