From f81f67301c19f843342d85b8eb2094ea68290b94 Mon Sep 17 00:00:00 2001 From: David Fisher Date: Mon, 28 Aug 2017 10:24:19 -0400 Subject: [PATCH 1/3] m2 --- src/m2_hello_world.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/m2_hello_world.py b/src/m2_hello_world.py index 74f5919..288bcb5 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 +# TO DO # 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,11 @@ # Look at the Console to be sure that your string printed as expected. # ######################################################################## +print("David Fisher can write Python programs") ######################################################################## # -# 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 +74,11 @@ # (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 in the # PyDev Package Explorer # to the left. From 6a2c2f3bdd591a3b9442fb112b238e98358be2b2 Mon Sep 17 00:00:00 2001 From: David Fisher Date: Mon, 28 Aug 2017 10:31:52 -0400 Subject: [PATCH 2/3] m3 --- src/m3_turtles.py | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/m3_turtles.py b/src/m3_turtles.py index 1eee3d9..25f90cb 100644 --- a/src/m3_turtles.py +++ b/src/m3_turtles.py @@ -29,10 +29,11 @@ ######################################################################## # -# 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 +# Watch the red underlines on the line of code above disappear as you do that step. # You will do that once for every project that uses rosegraphics so get used to it. :) # # Run this module by Right clicking in this window and select Run 'filename' @@ -59,6 +60,7 @@ # ---------------------------------------------------------------------- # Ask the SimpleTurtle objects to do things: # ---------------------------------------------------------------------- +nadia.speed = 10 nadia.forward(100) nadia.left(90) nadia.forward(200) @@ -68,14 +70,18 @@ # ---------------------------------------------------------------------- akil = rg.SimpleTurtle('turtle') akil.pen = rg.Pen('red', 30) -akil.speed = 1 +akil.speed = 10 akil.backward(50) akil.left(90) akil.forward(50) +akil.pen = rg.Pen('aquamarine', 15) +akil.forward(50) + + ######################################################################## # -# 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. @@ -108,14 +114,28 @@ # ######################################################################## +dave = rg.SimpleTurtle('turtle') +dave.speed = 20 +dave.pen = rg.Pen('lavender', 5) +dave.right(90) +dave.forward(100) + ######################################################################## # -# 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. # # Then COMMIT and Push your work using the VCS menu option. # +# Reminder of those steps... +# COMMIT your work by selecting VCS from the menu bar, then select Commit Changes +# Make sure only the files you want to commit are checked and optionally +# add a quick Commit message to describe your work. Then hover over the +# Commit button and select Commit and Push. Commit saves the work to +# your computer. "and Push" saves a copy of your work up into your Github +# repository (saving to the cloud is a better way to permanently safe work). +# # You can COMMIT as often as you like. DO FREQUENT COMMITS. # ######################################################################## From d39a2cee55f39e77da764846417813edd05a1ec4 Mon Sep 17 00:00:00 2001 From: David Fisher Date: Mon, 28 Aug 2017 10:40:51 -0400 Subject: [PATCH 3/3] simple m5 --- src/m5_your_turtles.py | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/src/m5_your_turtles.py b/src/m5_your_turtles.py index d9de2a6..c56a1d0 100644 --- a/src/m5_your_turtles.py +++ b/src/m5_your_turtles.py @@ -2,15 +2,17 @@ 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 Dave Fisher. """ ######################################################################## -# TODO: 1. +# DONE: 1. # On Line 5 above, replace PUT_YOUR_NAME_HERE with your own name. ######################################################################## +import rosegraphics as rg + ######################################################################## -# 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 +30,29 @@ # # Don't forget to COMMIT your work by using VCS ~ Commit and Push. ######################################################################## + +window = rg.TurtleWindow() + +dave = rg.SimpleTurtle('turtle') +dave.speed = 20 +dave.pen = rg.Pen('red4', 5) +for k in range(8): + dave.left(45) + dave.forward(50) + +dave.pen_up() + +bob = rg.SimpleTurtle('turtle') +bob.speed = 20 +bob.pen = rg.Pen('green', 5) +bob.pen_up() +bob.backward(75) +bob.left(90) +bob.forward(75) +bob.right(90) +bob.pen_down() +for k in range(3): + bob.forward(100) + bob.right(120) + +window.close_on_mouse_click()