-
-
Save hadley/6db2217dff40cb56b524943492771227 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 2022-01-06 | |
# https://www.powerlanguage.co.uk/wordle/ | |
library(stringr) | |
words <- words::words$word | |
words5 <- words[str_length(words) == 5] | |
# Find 5 letter containing most common letters | |
# (data from random googling) | |
common <- c("e", "a", "r", "i", "t", "n", "s", "l", "c", "u", "d", "p", "m", "h") | |
words5u %>% | |
str_subset(paste0("^[", paste0(common[1:5], collapse = ""), "]+$")) | |
# only irate is a common English word | |
words5 %>% | |
# "irate" 🟨🟨⬛🟨🟨 | |
str_subset("[^i][^r].[^t][^e]") %>% | |
str_subset("a", negate = TRUE) %>% | |
str_subset("i") %>% | |
str_subset("r") %>% | |
str_subset("t") %>% | |
str_subset("e") %>% | |
# "merit" ⬛🟨🟨🟨🟨 | |
str_subset("m", negate = TRUE) %>% | |
str_subset(".[^e][^r][^i][^t]") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
that's pretty neat