""" An exercise that summarizes what you have learned in this Session. Authors: David Mutchler, Rachel Krohn, Scott McClellan, Yiji Zhang, Mark Hays, Vibha Alangar, Matt Boutell, Dave Fisher, Sriram Mohan, Amanda Stouder, Mohammed Noureddine, Valerie Galluzzi, their colleagues and PUT_YOUR_NAME(S)_HERE. """ ############################################################################### # TODO: 1. # On Line 7 above, replace PUT_YOUR_NAME(S)_HERE with your own name(s). ############################################################################### import rosegraphics as rg import math ############################################################################### # TODO: 2. # Write code that accomplishes the following (and ONLY the following): # _ # - Constructs a SimpleTurtle with a "blue", thickness 1 Pen. # - Constructs a SimpleTurtle with shape "turtle" and a "red", # thickness 5 Pen. # - Makes the SimpleTurtle with a "blue" Pen: # 1. Go straight UP 200 pixels. # 2. Lift its pen UP # (so that the next movements do NOT leave a "trail"). # HINT: Use the "dot trick" to figure out how to do this. # 3. Go to the Point whose: # -- x-coordinate is 35 times the sine of 0.75 (radians) # -- y-coordinate is 4 raised to the math.pi power # HINT: Use the "dot trick" to figure out how to go to a Point. # 4. Put its pen DOWN # (so that the next movements will return to leaving a "trail"). # 5. Change its Pen's color to "green" and thickness 20. # 6. Go down and to the left at a 45 degree angle, for 150 pixels. # - Makes the SimpleTurtle with a "red" Pen, with shape "turtle". # 7. Go 50 times the cosine of 0.3 (radians) pixels straight to the LEFT. # 8. Then go 150 pixels straight DOWN. # - Makes the SimpleTurtle with a Pen that was "blue" but is now "green" # 9. Continue forward (in the same direction that it has been going) # 75 more pixels. # _ # See the turtles.PDF file for what the final result should look like. # _ # Don't forget to: # - Import rosegraphics # - Construct a TurtleWindow # [remember the required PARENTHESES for constructing an object!] # at the BEGINNING of your code. # - Ask your TurtleWindow to close_on_mouse_click # as the LAST line of your code. (Again, parentheses needed!) # See the beginning and end of m7e_loopy_turtles for an example. # _ # As always, test by running the module. ############################################################################### window = rg.TurtleWindow() turtle = rg.SimpleTurtle() turtle.pen = rg.Pen("blue", 1) turtle2 = rg.SimpleTurtle("turtle") turtle2.pen = rg.Pen("red", 5) turtle.left(90) turtle.forward(200) turtle.pen_up() turtle.go_to(rg.Point(35 * math.sin(0.75), 4 ** math.pi)) turtle.pen_down() turtle.pen = rg.Pen("green", 20) turtle.left(135) turtle.forward(150) turtle2.left(180) turtle2.forward(50 * math.cos(0.3)) turtle2.right(90) turtle2.forward(150) turtle.forward(75) window.close_on_mouse_click() ############################################################################### # TODO: 3. After you have successfully written and tested code per the above # (get help as needed!), be sure that you understand how to: # -- CONSTRUCT an INSTANCE of a CLASS (we call such instances OBJECTS). # -- Make an object ** DO ** something by using a METHOD. # -- Reference an object's ** DATA ** by using an INSTANCE VARIABLE. # _ # If those concepts are not clear to you, ASK FOR HELP. # Once you understand those concepts, change the above _TODO_ to DONE. # _ # As always, COMMIT-and-PUSH when you are done with this module. ###############################################################################