diff --git a/src/m2_hello_world.py b/src/m2_hello_world.py index aaa506a..a5a6ed0 100644 --- a/src/m2_hello_world.py +++ b/src/m2_hello_world.py @@ -13,7 +13,7 @@ ######################################################################## # -# TODO: 1. +# DONE: 1. # (Yes, that means for YOU to DO things per these instructions:) # # Run this module by right clicking anywhere in this window and select @@ -26,7 +26,7 @@ ######################################################################## # -# TODO: 2. +# DONE: 2. # Notice the small horizontal BLUE bars on the scrollbar-like thing # on the right. Each blue bar indicates a TO DO in this module. # @@ -34,7 +34,7 @@ # by clicking on the blue bars. ** Try that now. ** # # b. When you have completed a TO DO, you should change the word -# TODO +# DONE # to # DONE. # Try it now on line 16 above, and note that its blue bar on @@ -51,7 +51,7 @@ ######################################################################## # -# TODO: 3. +# DONE: 3. # Add another print statement below. # It should print any string that you want (but keep it G-rated!) # Test your code by re-running this module using either the right click @@ -59,10 +59,12 @@ # Look at the Console to be sure that your string printed as expected. # ######################################################################## +print('Joy to the World') + ######################################################################## # -# TODO: 4. +# DONE: 4. # Add yet another print statement. # This one should print the *product* of 3,607 and 34,227. # Let the computer do the arithmetic for you (no calculators!). @@ -73,10 +75,12 @@ # (HINT: It is an INTERESTING number.) Get help if your value is wrong. # ######################################################################## +print(3607 * 34227) + ######################################################################## # -# TODO: 5. +# DONE: 5. # Look at the list of files in this project to the left. # Note that this file (m2_hello_world.py) is now displayed in a blue # font color (if the file is highlighted select a different file so yu can diff --git a/src/m3_turtles.py b/src/m3_turtles.py index df507f3..022ced3 100644 --- a/src/m3_turtles.py +++ b/src/m3_turtles.py @@ -10,11 +10,11 @@ -- ASSIGNING a VALUE to a NAME (VARIABLE). Authors: David Mutchler, Dave Fisher, Valerie Galluzzi, Amanda Stouder, - their colleagues and PUT_YOUR_NAME_HERE. + their colleagues and Ryan Feetham. """ ######################################################################## # -# TODO: 1. +# DONE: 1. # (Yes, that means for YOU to DO things per these instructions:) # # On Line 13 above, replace PUT_YOUR_OWN_NAME_HERE with your OWN name. @@ -29,7 +29,7 @@ ######################################################################## # -# TODO: 2. +# DONE: 2. # Allow this file to use the rosegraphics.py file by marking the src # directory as a "Sources Root". Do that by right clicking on the src folder, # then selector Mark Directory As --> Sources Root @@ -74,10 +74,16 @@ matt.left(90) matt.forward(50) +dave.pen = rg.Pen('green', 10) +dave.left(90) +dave.forward(200) +matt.pen = rg.Pen('blue', 20) +matt.right(90) +matt.forward(300) ######################################################################## # -# TODO: 3. +# DONE: 3. # Add a few more line of your own code above to make one of the # existing Turtles move some more and/or have different # characteristics. @@ -89,9 +95,10 @@ # ######################################################################## + ######################################################################## # -# TODO: 4. +# DONE: 4. # The code above CONSTRUCTS two SimpleTurtle objects and gives those objects NAMES: # dave matt # @@ -109,10 +116,17 @@ # As always, test by running the module. # ######################################################################## +Ryan = rg.SimpleTurtle() +Ryan.forward(250) +Ryan.left(135) +Ryan.pen = rg.Pen('purple',30) +Ryan.forward(400) +Ryan.right(270) +Ryan.forward(200) ######################################################################## # -# TODO: 5. +# DONE: 5. # Run one more time to be sure that all is still OK. # Ensure that no blue bars on the scrollbar-thing to the right remain. # diff --git a/src/m5_your_turtles.py b/src/m5_your_turtles.py index d9de2a6..57dc23c 100644 --- a/src/m5_your_turtles.py +++ b/src/m5_your_turtles.py @@ -2,15 +2,15 @@ Your chance to explore Loops and Turtles! Authors: David Mutchler, Dave Fisher, Valerie Galluzzi, Amanda Stouder, - their colleagues and PUT_YOUR_NAME_HERE. + their colleagues and Ryan Fleetham. """ ######################################################################## -# TODO: 1. +# DONE: 1. # On Line 5 above, replace PUT_YOUR_NAME_HERE with your own name. ######################################################################## ######################################################################## -# TODO: 2. +# DONE: 2. # # You should have RUN the PREVIOUS module and READ its code. # (Do so now if you have not already done so.) @@ -28,3 +28,134 @@ # # Don't forget to COMMIT your work by using VCS ~ Commit and Push. ######################################################################## +import rosegraphics as rg + +# define constants +speed = 10 +size = 100 +thickness = 3 + +window = rg.TurtleWindow() + +# set up all of the turtles +blue_turtle = rg.SimpleTurtle('turtle') +blue_turtle.pen = rg.Pen('blue', thickness) +blue_turtle.speed = speed + +red_turtle = rg.SimpleTurtle('turtle') +red_turtle.pen = rg.Pen('red', thickness) +red_turtle.speed = speed + +green_turtle = rg.SimpleTurtle('turtle') +green_turtle.pen = rg.Pen('green', thickness) +green_turtle.speed = speed + +purple_turtle = rg.SimpleTurtle('turtle') +purple_turtle.pen = rg.Pen('purple', thickness) +purple_turtle.speed = speed + +orange_turtle = rg.SimpleTurtle('turtle') +orange_turtle.pen = rg.Pen('orange', thickness) +orange_turtle.speed = speed + +pink_turtle = rg.SimpleTurtle('turtle') +pink_turtle.pen = rg.Pen('pink', thickness) +pink_turtle.speed = speed + +brown_turtle = rg.SimpleTurtle('turtle') +brown_turtle.pen = rg.Pen('brown', thickness) +brown_turtle.speed = speed + +black_turtle = rg.SimpleTurtle('turtle') +black_turtle.pen = rg.Pen('black', thickness) +black_turtle.speed = speed + +for k in range(4): + # Put the pen down, then draw a square of the given size: + blue_turtle.draw_square(size) + + # Pick up the pen and turn right + blue_turtle.pen_up() + blue_turtle.right(90) + + # Put the pen down again (so drawing resumes). + blue_turtle.pen_down() + +for k in range(3): + # Put the pen down, then draw a triangle of the given size: + red_turtle.draw_regular_polygon(3, size) + + # Pick up the pen and turn right. + red_turtle.pen_up() + red_turtle.left(120) + + # Put the pen down again (so drawing resumes). + red_turtle.pen_down() + +for k in range(5): + # Put the pen down, then draw a pentagon of the given size: + green_turtle.draw_regular_polygon(5, size) + + # Pick up the pen and turn right + green_turtle.pen_up() + green_turtle.left(72) + + # Put the pen down again (so drawing resumes). + green_turtle.pen_down() + +for k in range(6): + # Put the pen down, then draw a hexagon of the given size: + purple_turtle.draw_regular_polygon(6, size) + + # Pick up the pen and turn right + purple_turtle.pen_up() + purple_turtle.left(60) + + # Put the pen down again (so drawing resumes). + purple_turtle.pen_down() + +for k in range(7): + # Put the pen down, then draw a heptagon of the given size: + orange_turtle.draw_regular_polygon(7, size) + + # Pick up the pen and turn right + orange_turtle.pen_up() + orange_turtle.left(51.4285714) + + # Put the pen down again (so drawing resumes). + orange_turtle.pen_down() + +for k in range(8): + # Put the pen down, then draw a octagon of the given size: + pink_turtle.draw_regular_polygon(8, size) + + # Pick up the pen and turn right + pink_turtle.pen_up() + pink_turtle.left(45) + + # Put the pen down again (so drawing resumes). + pink_turtle.pen_down() + +for k in range(9): + # Put the pen down, then draw a nonagon of the given size: + brown_turtle.draw_regular_polygon(9, size) + + # Pick up the pen and turn right + brown_turtle.pen_up() + brown_turtle.left(40) + + # Put the pen down again (so drawing resumes). + brown_turtle.pen_down() + +for k in range(10): + # Put the pen down, then draw a decagon of the given size: + black_turtle.draw_regular_polygon(10, size) + + # Pick up the pen and turn right + black_turtle.pen_up() + black_turtle.left(36) + + # Put the pen down again (so drawing resumes). + black_turtle.pen_down() + +window.close_on_mouse_click()