Title: | Retro Logic Game |
---|---|
Description: | Logic game in the style of the early 1980s home computers that can be played in the R console. This game is inspired by Mastermind, a game that became popular in the 1970s. Can you break the code? |
Authors: | Roland Krasser [aut, cre] |
Maintainer: | Roland Krasser <[email protected]> |
License: | GPL-3 |
Version: | 1.0.1 |
Built: | 2024-11-21 02:48:43 UTC |
Source: | https://github.com/rolkra/codebreaker |
Check code if correct
cb_check_code(code_check, code_secret)
cb_check_code(code_check, code_secret)
code_check |
Code to check |
code_secret |
Secret code |
list
Clean code
cb_clean_code(code, code_length = 4)
cb_clean_code(code, code_length = 4)
code |
Code |
code_length |
Length of code |
clean code
Convert code into a vector
cb_code2vector(code)
cb_code2vector(code)
code |
Code |
vector
Input code
cb_input_code(step = 1, code_length = 4, color_list = c("R", "B"))
cb_input_code(step = 1, code_length = 4, color_list = c("R", "B"))
step |
Step |
code_length |
Length of code |
color_list |
List of available colors |
code
Show Code Breaker Intro
cb_intro(name = NULL)
cb_intro(name = NULL)
name |
Player name |
Prints sprite in console
Play a code breaker game
cb_play_game(colors = NA, empty = FALSE, sound = TRUE, name = NULL)
cb_play_game(colors = NA, empty = FALSE, sound = TRUE, name = NULL)
colors |
Colors that can be used in game |
empty |
Empty code digit in secret code allowed? |
sound |
Play sounds? |
name |
Player name |
list
Show Code Breaker Race Cup
cb_race_cup(name = NULL)
cb_race_cup(name = NULL)
name |
Player name |
Prints sprite in console
Selct Colors
cb_select_colors(colors = NA, empty = FALSE, name = NULL)
cb_select_colors(colors = NA, empty = FALSE, name = NULL)
colors |
Selected colors |
empty |
Empty code digit in secret code allowed? |
name |
Player name |
Print selected colors in console
Show code in console
cb_show_code(code)
cb_show_code(code)
code |
Code |
Console output
Show color in console
cb_show_color(color)
cb_show_color(color)
color |
Color |
Prints color in console
Show Code Breaker Success
cb_success(name = NULL)
cb_success(name = NULL)
name |
Player name |
Prints sprite in console
Play codebreaker game
codebreaker(sound = TRUE, name = NULL)
codebreaker(sound = TRUE, name = NULL)
sound |
Play sounds? |
name |
Name of player |
list
## Start game (in interactive R sessions) if (interactive()) { codebreaker() }
## Start game (in interactive R sessions) if (interactive()) { codebreaker() }
Print sprite in console
sprite_show(txt)
sprite_show(txt)
txt |
Text string containing sprite definition |
Prints sprite in console