Learn R Programming

karel (version 0.1.1)

generate_world: Create Karel's world

Description

This function takes a "world" (i.e. a list with data about its size, walls, beepers and Karel's position and direction), plots it and prepares everything so that Karel can start performing actions in it. It must be run always before Karel starts working on her goals, especially if we have made a mistake, we must start all over again by first running this function.

Usage

generate_world(world)

Arguments

world

Character vector of length 1 with the name of one of the provided worlds in the package or a list provided by the user with all the components that a world needs (see more below in details).

Value

Plots the initial state of Karel's world and prepares everything to start recording her actions.

Details

After running generate_mundo(), we can run Karel's actions and finally visualize it all with the function run_actions().

Argument world can be create by the user. In this case, it must be a list with the following components:

  1. nx: TODO

  2. ny:

  3. hor_walls:

  4. ver_walls:

  5. karel_x:

  6. karel_y:

  7. karel_dir:

  8. beepers_x:

  9. beepers_y:

  10. beepers_n:

  11. beepers_bag:

See Also

actions run_actions

Examples

Run this code
# NOT RUN {
generate_world("mundo001")

# }

Run the code above in your browser using DataLab