play_game: Play the holoalphabetic game

Description Usage Arguments Value See Also Examples

View source: R/game.R

Description

play_game provides an interactive interface for guessing words based on a game made by create_game. If you call this function directly, it will create the game itself. Assigning the results to a variable will allow you to pause and continue the game later by running play_game(prev_game).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
play_game(
  game = NULL,
  keep_central_first = FALSE,
  restart = FALSE,
  game_letters = NULL,
  central = NULL,
  num_letters = 7,
  min_word_length = 4,
  dictionary = "normal",
  obscenities = FALSE
)

Arguments

game

A game object created by create_game. If null, the default, play_game will create a new game object. Alternatively, if using a previous game, game will contain both the game and state variables.

keep_central_first

Logical. Should the game always display the "central" letter first when printing the letters. Defaults to FALSE.

restart

Logical. Only useful when trying anew with an existing game. Deletes previous guesses and starts with a clean slate, while using the same letters (and therefore words).

The remaining arguments are passed to the create_game function and all can be left out.

game_letters

User-selected letters to use in the game. Will result in a warning if more letters are chosen than num_letters. If including, this should be a character string, e.g., "stb".

central

The central (that is, required) letter. If not provided, will be randomly chosen from among the game_letters.

num_letters

The number of letters for the game; defaults to 7, and should be between 6 and 10.

min_word_length

Expected length of words. Defaults to 4 letters, but can be between 2 and 6.

dictionary

Character string. Choice of how detailed of a dictionary to use. Can be any of "slim", "broad", or "normal". Defaults to "normal", which is recommended.

obscenities

Logical. Should obscenities be included? Defaults to FALSE.

Value

Regardless of whether you include any inputs, the code will run a version of the game. If passed a game object from create_game, the game will use the same letters and words. If passed a previously-played game from play_game, the game will pick up where you left off, and remind you of past guesses. Assign play_game to a variable to keep playing later.

See Also

create_game to set up a game without playing.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
play_game()

# assuming a saved game called prev_game
play_game(game = prev_game)

# permit obscenities
play_game(keep_central_first = TRUE,
          obscenities = TRUE)

## End(Not run)

jdbest/holoalphabetic documentation built on Feb. 10, 2022, 10:11 p.m.