Learn R Programming

lares (version 4.10.6)

scrabble_words: Scrabble: Highest score words finder

Description

Find highest score words given a set of letters, rules, and language to win at Scrabble! You just have to find the best place to post your tiles.

Usage

scrabble_words(
  tiles,
  free = 0,
  force_start = "",
  force_end = "",
  force_str = "",
  force_n = 0,
  force_max = 0,
  scores = Sys.getenv("LARES_LANG"),
  language = Sys.getenv("LARES_LANG"),
  words = NA,
  quiet = FALSE
)

Arguments

tiles

Character. The letters you wish to consider.

free

Integer. How many free blank tiles you have?

force_start, force_end

Character. Force words to start or end with a pattern of letters and position. Examples: "S" or "SO" or "__S_O"... If the string contains tiles that were not specified in tiles, they will automatically be included.

force_str

Character vector. Force words to contain strings. If the string contains tiles that were not specified in tiles, they will automatically be included.

force_n, force_max

Integer. Force words to be n or max n characters long. Leave 0 to ignore parameter.

scores, language

Character. Any of "en","es","de","fr". If scores is not any of those languages, must be a data.frame that contains two columns: "tiles" with every letter of the alphabet and "scores" for each letter's score. If you wish to overwrite or complement this dictionaries other words you can set to "none" and/or use the words parameter. You might also want to set this parameter globally with Sys.setenv("LARES_LANG" = "en") and forget about it!

words

Character vector. Use if you wish to manually add words.

quiet

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

Value

data.frame with matching words found, sorted by higher points.

See Also

Other Scrabble: scrabble_dictionary(), scrabble_points(), scrabble_score()

Examples

Run this code
# NOT RUN {
# Automatic use of languages and scores
Sys.setenv("LARES_LANG" = "es")
scrabble_words(tiles = "hola",
               free = 2,
               force_start = "h",
               #force_end = "",
               force_str = "_o_a",
               force_n = 5,
               force_max = 0,
               quiet = TRUE)

# Words considered for a language (you can custom it too!)
es_words <- scrabble_dictionary("es")
# }

Run the code above in your browser using DataLab