Robot Basic Exercises

2
ROBOT BASIC EXERCISES DIRECTIONS: Do a specific exercise from the list below when I tell you to; test it-if it works correctly, submit through Synchroneyes. 1) Create a robot in the upper-left corner of the screen and make the robot move around the perimeter (the outside boundary) of the screen (in a rectangular motion) until it gets back to its original position. Save this as EXERCISE 1. 2) Create a robot in the upper-left corner of the screen and make the robot move diagonally down to the lower-right corner and then back to its original position. . Save this as EXERCISE 2. 3) Enter the following program. When you run it, it should draw four rectangles on the screen. Save this as EXERCISE 3. LineWidth 3 Rectangle 100, 100, 350, 200 Rectangle 400, 100, 650, 200 Rectangle 400, 350, 650, 450 Rectangle 100, 350, 350, 450 End 4) Enter the following program. It uses variables to create the same four rectangles as exercise #3. Save this as EXERCISE 4. LineWidth 3 width = 250 height = 100 X = 100 Y = 100 Rectangle x, y, x + width, y + height

Transcript of Robot Basic Exercises

Page 1: Robot Basic Exercises

ROBOT BASIC EXERCISES

DIRECTIONS: Do a specific exercise from the list below when I tell you to; test it-if it works correctly, submit through Synchroneyes.

1) Create a robot in the upper-left corner of the screen and make the robot move around the perimeter (the outside boundary) of the screen (in a rectangular motion) until it gets back to its original position. Save this as EXERCISE 1.

2) Create a robot in the upper-left corner of the screen and make the robot move diagonally down to the lower-right corner and then back to its original position. . Save this as EXERCISE 2.

3) Enter the following program. When you run it, it should draw four rectangles on the screen. Save this as EXERCISE 3.

LineWidth 3Rectangle 100, 100, 350, 200Rectangle 400, 100, 650, 200Rectangle 400, 350, 650, 450Rectangle 100, 350, 350, 450End

4) Enter the following program. It uses variables to create the same four rectangles as exercise #3. Save this as EXERCISE 4.

LineWidth 3width = 250height = 100X = 100Y = 100Rectangle x, y, x + width, y + heightX = 400Rectangle x, y, x + width, y + heightY = 350Rectangle x, y, x + width, y + heightX = 100Rectangle x, y, x + width, y + heightEnd

5) Open Exercise 3 and Save it as Exercise 5. Add a robot by using rLocate. Use rForward to have the robot move around the four rectangle. Run it and see if he (she?) bumps

Page 2: Robot Basic Exercises

into any of the rectangles. If it does, the program will stop and a message will appear. Use rTurn to avoid contact with the rectangles and the boundary of the screen. If your robot can avoid contact for AT LEAST five seconds, you’ve done a good job. Submit through Synchoneyes.

6) Open Exercise 4 and Save it as Exercise 6. Do the same thing you did for exercise 5, WITH THE FOLLOWING ADDITIONS: 1. Add a variable called F, which will be used with the rForward command. Add a variable called T, which will be used with the rTurn command. Something like this:

F = 1T = 90

rForward FrTurn T

You may have to change the values of F and T during the program at least once. If your robot can avoid contact for AT LEAST five seconds, you’ve done a good job. Submit through Synchoneyes.