Package 'codebreaker'

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

Help Index


Check code if correct

Description

Check code if correct

Usage

cb_check_code(code_check, code_secret)

Arguments

code_check

Code to check

code_secret

Secret code

Value

list


Clean code

Description

Clean code

Usage

cb_clean_code(code, code_length = 4)

Arguments

code

Code

code_length

Length of code

Value

clean code


Convert code into a vector

Description

Convert code into a vector

Usage

cb_code2vector(code)

Arguments

code

Code

Value

vector


Input code

Description

Input code

Usage

cb_input_code(step = 1, code_length = 4, color_list = c("R", "B"))

Arguments

step

Step

code_length

Length of code

color_list

List of available colors

Value

code


Show Code Breaker Intro

Description

Show Code Breaker Intro

Usage

cb_intro(name = NULL)

Arguments

name

Player name

Value

Prints sprite in console


Play a code breaker game

Description

Play a code breaker game

Usage

cb_play_game(colors = NA, empty = FALSE, sound = TRUE, name = NULL)

Arguments

colors

Colors that can be used in game

empty

Empty code digit in secret code allowed?

sound

Play sounds?

name

Player name

Value

list


Show Code Breaker Race Cup

Description

Show Code Breaker Race Cup

Usage

cb_race_cup(name = NULL)

Arguments

name

Player name

Value

Prints sprite in console


Selct Colors

Description

Selct Colors

Usage

cb_select_colors(colors = NA, empty = FALSE, name = NULL)

Arguments

colors

Selected colors

empty

Empty code digit in secret code allowed?

name

Player name

Value

Print selected colors in console


Show code in console

Description

Show code in console

Usage

cb_show_code(code)

Arguments

code

Code

Value

Console output


Show color in console

Description

Show color in console

Usage

cb_show_color(color)

Arguments

color

Color

Value

Prints color in console


Show Code Breaker Success

Description

Show Code Breaker Success

Usage

cb_success(name = NULL)

Arguments

name

Player name

Value

Prints sprite in console


Play codebreaker game

Description

Play codebreaker game

Usage

codebreaker(sound = TRUE, name = NULL)

Arguments

sound

Play sounds?

name

Name of player

Value

list

Examples

## Start game (in interactive R sessions)
if (interactive())  {
   codebreaker()
}

Print sprite in console

Description

Print sprite in console

Usage

sprite_show(txt)

Arguments

txt

Text string containing sprite definition

Value

Prints sprite in console