Create a wordsearch puzzle

wordsearch(
  words = c("finding", "needles", "inside", "haystacks"),
  clues = words,
  r = 10,
  c = 10,
  image = NULL
)

Arguments

words

a vector of hidden words (character/vector)

clues

a vector of word clues (optional; character/vector)

r

number of rows

c

number of columns

image

path to an image that the resulting grid should look like.NULL for no shape

Value

a 'wordsearch' object

Examples

# \donttest{
# Example 1 ----
words <- c("dog", "cat", "horse", "frog", "cow", "fox")
ex1 <- wordsearch(words, r = 10, c = 10)
#> Found positions for 6/6 words.
plot(ex1, solution = TRUE)


# Example 2 ----
clues <- c("Bark", "Meow", "Neigh", "Ribbit", "Moo", "Nee Nee Nee")
ex2 <- wordsearch(words = words, clues = clues)
#> Found positions for 6/6 words.
plot(ex2, solution = TRUE, title = "Animal Sounds", legend_size = 4)


# Example 3 ----
math <- dplyr::tribble(
  ~problem,  ~solution,
  "2 + 2",   "four",
  "5 + 3",   "eight",
  "9 - 4",   "five",
  "1 + 0",   "one",
  "2 + 1",   "three",
  "5 + 5",   "ten",
  "6 - 6",   "zero"
 )
 ex3 <- wordsearch(words = math$solution, clues = math$problem)
#> Found positions for 7/7 words.
 plot(ex3, solution = TRUE, title = "Math is Fun")

# }