Title: | R Warrior - An AI Programming Game |
---|---|
Description: | A port of Ruby Warrior. Teaches R programming in a fun and interactive way. |
Authors: | Rick M Tankard [cre, aut] |
Maintainer: | Rick M Tankard <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.4.1 |
Built: | 2024-12-14 06:48:17 UTC |
Source: | CRAN |
The starting point for R Warrior. Run this before attempting each level with play_warrior().
level_readme(level = 1, tower = c("beginner"))
level_readme(level = 1, tower = c("beginner"))
level |
The level number (or custom level). |
tower |
The tower the level comes from. |
level_readme(1)
level_readme(1)
Write a single AI function to play through each level of the specified tower. Refine your AI in order to achieve an overall S rank.
play_epic( ai, tower = c("beginner"), warrior_name = "Fisher", level_output = TRUE, sleep = getOption("rwarrior.sleep", ifelse(interactive(), 0.6, 0)) )
play_epic( ai, tower = c("beginner"), warrior_name = "Fisher", level_output = TRUE, sleep = getOption("rwarrior.sleep", ifelse(interactive(), 0.6, 0)) )
ai |
AI function to control your warrior. |
tower |
Tower to attempt. |
warrior_name |
Name of your warrior, for flavor. |
level_output |
A logical denoting whether to give individual level progress. |
sleep |
Time between text updates. Set to "prompt" to only progress when pressing the return key. |
A tibble if successful, or otherwise FALSE.
A tibble giving the scores for each level passed.
AI <- function(warrior, memory) { if(is.null(memory)) { # set memory initial values here } # Modify the following section to be able to complete the tower warrior$walk() memory } play_epic(AI, tower = "beginner", warrior_name = "Euler")
AI <- function(warrior, memory) { if(is.null(memory)) { # set memory initial values here } # Modify the following section to be able to complete the tower warrior$walk() memory } play_epic(AI, tower = "beginner", warrior_name = "Euler")
Attempt inbuilt levels of R Warrior.
play_warrior( ai, level = 1, tower = c("beginner"), warrior_name = "Fisher", sleep = getOption("rwarrior.sleep", ifelse(interactive(), 0.6, 0)), practice = FALSE )
play_warrior( ai, level = 1, tower = c("beginner"), warrior_name = "Fisher", sleep = getOption("rwarrior.sleep", ifelse(interactive(), 0.6, 0)), practice = FALSE )
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. |
A tibble if successful, FALSE if unsuccessful, and NA if the AI function caused an error or no action was called.
AI <- function(warrior, memory) { if(is.null(memory)) { # set memory initial values here } # insert AI code here memory } play_warrior(AI, level = 1)
AI <- function(warrior, memory) { if(is.null(memory)) { # set memory initial values here } # insert AI code here memory } play_warrior(AI, level = 1)