Learn R Programming

TurtleGraphics (version 1.0-8)

turtle_turn: Turn (Rotate) the Turtle

Description

Turn the Turtle in the given direction by the given angle.

Usage

turtle_turn(angle, direction = c("left", "right"))

turtle_left(angle)

turtle_right(angle)

Arguments

angle

single numeric value; rotation angle in degrees. A negative value turns the Turtle in the opposite direction than the given one.

direction

character string; direction of the turn. Possible values are "left" and "right".

Details

The Turtle must be initialized prior to using this function, see turtle_init.

See Also

Other TurtleGraphics: TurtleGraphics-package, turtle_do, turtle_getpos, turtle_goto, turtle_init, turtle_move, turtle_param, turtle_reset, turtle_show, turtle_status, turtle_up

Examples

Run this code
# NOT RUN {
turtle_init()
turtle_left(30) # equivalent to turtle_turn(30, "left")
turtle_right(40)
turtle_turn(30, sample(c("left", "right"), 1)) # random turn

# }

Run the code above in your browser using DataLab