ROTATE
Description
ROTATE is a movement command that makes the robot rotate N % 360 degrees counter-clockwise.
The robot operates efficiently when processing this command - if N % 360 < 180, it turns to the left N % 360 degrees. Otherwise, it turns to the right 360 - (N % 360) degrees.
Syntax
ROTATE N
Arguments
N: angle value in degrees
Example
Input
DISPLAY "I am rotating 90 degrees to the left!"
SLEEP 3
ROTATE 90
DISPLAY "Resetting position..."
SLEEP 3
ROTATE 270
Output
Screen will display "I am rotating 90 degrees to the left!" with a three second pause. Then, since N is less than 180, the robot will rotate to the left 90 degrees. Then, the screen will display "Resetting position..." with a three second pause. The next rotate command has N greater than 180, so the robot will now turn to the right 360 - 270 degrees (90 degrees).
Resources
Explore the SaviScript GitHub repository for all published instances of this command.