Question: Modify the program below from ( Jupyter Notebook robot simulator Robolab ) so it draws the pattern on picture: % % sim _ magic _

Modify the program below from (Jupyter Notebook robot simulator Robolab)
so it draws the pattern on picture:
%%sim_magic_preloaded -p --pencolor green -a 0
SIDES =4
# Try to draw a square
STEERING =-100
TURN_ROTATIONS =1.6
TURN_SPEED =10
STRAIGHT_SPEED_PC = SpeedPercent(40)
STRAIGHT_ROTATIONS =4
def draw_square(side=STRAIGHT_ROTATIONS):
"""Draw square of specified side length."""
for side_number in range(SIDES):
# Go straight
# Set the left and right motors in a forward direction
# and run for the number of rotations specified by: side
tank_drive.on_for_rotations(STRAIGHT_SPEED_PC,
STRAIGHT_SPEED_PC,
# Use provided side length
side)
# Slight graceful turn to lef
tank_drive.on_for_rotations(SpeedPercent(35), SpeedPercent(50),8.5)
#Turn
# Set the robot to turn on the spot
# and run for a certain number of rotations *of the wheels*
tank_turn.on_for_rotations(STEERING,
SpeedPercent(TURN_SPEED),
TURN_ROTATIONS)
# Call the function to draw a small size square
draw_square(4)
# And an even smaller square
draw_circle(4)
Modify the program below from ( Jupyter Notebook

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!