play_warrior {rwarrior}R Documentation

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
)

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.

Value

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

Examples

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

[Package rwarrior version 0.4.1 Index]