Learn R Programming

rwarrior (version 0.4.1)

play_warrior: Play R Warrior

Description

Attempt inbuilt levels of R Warrior.

Usage

play_warrior(
  ai,
  level = 1,
  tower = c("beginner"),
  warrior_name = "Fisher",
  sleep = getOption("rwarrior.sleep", ifelse(interactive(), 0.6, 0)),
  practice = FALSE
)

Value

A tibble if successful, FALSE if unsuccessful, and NA if the AI function caused an error or no action was called.

Arguments

ai

AI function to control your warrior.

level

Level number.

tower

Tower the level comes from.

warrior_name

Name of your warrior, for flavor.

sleep

Time between text updates in seconds. Set to "prompt" to only progress when pressing the return key.

practice

If TRUE, any functions available for that tower may be used.

Examples

Run this code
AI <- function(warrior, memory) {
  if(is.null(memory)) {
    # set memory initial values here
  }
  # insert AI code here
  memory
}
play_warrior(AI, level = 1)

Run the code above in your browser using DataLab