February 2020
Intermediate to advanced
328 pages
8h 19m
English
Let's programmatically create an environment for our problem:
states <- c("1", "2", "3", "4")actions <- c("up", "down", "left", "right")cat("The states are:",states)cat('\n')cat("The actions are:",actions)
gridExampleEnvironment <- function(state, action) { next_state <- state if (state == state("1") && action == "down") next_state <- state("4") if (state == state("1") && action == "right") next_state <- state("2") if (state == state("2") && action == "left") next_state <- state("1") if (state == state("2") && action == "right") next_state <- state("3") if (state == state("3") && action ...Read now
Unlock full access