turtle_turn: Turn (Rotate) the Turtle

Description Usage Arguments Details See Also Examples

Description

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

Usage

1
2
3
4
5
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

1
2
3
4
turtle_init()
turtle_left(30) # equivalent to turtle_turn(30, "left")
turtle_right(40)
turtle_turn(30, sample(c("left", "right"), 1)) # random turn

TurtleGraphics documentation built on May 2, 2019, 1:07 p.m.