From 09988664b7c1b66d98cd05cf369adf40796886b1 Mon Sep 17 00:00:00 2001 From: Cheryl Date: Sun, 26 Nov 2017 17:09:15 -0500 Subject: [PATCH 01/10] I added my name. --- src/m3_turtles.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m3_turtles.py b/src/m3_turtles.py index df507f3..0f4920a 100644 --- a/src/m3_turtles.py +++ b/src/m3_turtles.py @@ -10,7 +10,7 @@ -- 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 Cheryl He. """ ######################################################################## # From 826e387691ef2910a5eb71d32e8207a2b42f884f Mon Sep 17 00:00:00 2001 From: Cheryl Date: Mon, 27 Nov 2017 14:29:09 -0500 Subject: [PATCH 02/10] I completed all the TODOs --- src/m2_hello_world.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/m2_hello_world.py b/src/m2_hello_world.py index aaa506a..f00c869 100644 --- a/src/m2_hello_world.py +++ b/src/m2_hello_world.py @@ -13,7 +13,7 @@ ######################################################################## # -# TODO: 1. +# DONE # (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 # 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 +# TODOs # to # DONE. # Try it now on line 16 above, and note that its blue bar on @@ -51,7 +51,7 @@ ######################################################################## # -# TODO: 3. +# DONE # 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,10 @@ # Look at the Console to be sure that your string printed as expected. # ######################################################################## - +print("Hi there") ######################################################################## # -# TODO: 4. +# DONE # 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 +73,10 @@ # (HINT: It is an INTERESTING number.) Get help if your value is wrong. # ######################################################################## - +print(3607*34227) ######################################################################## # -# TODO: 5. +# DONE # 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 From 5f693696bd116cf31a0bfe33fca6d219a6dc0bef Mon Sep 17 00:00:00 2001 From: Cheryl Date: Mon, 27 Nov 2017 14:37:53 -0500 Subject: [PATCH 03/10] I added numbers to each DONE --- src/m2_hello_world.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/m2_hello_world.py b/src/m2_hello_world.py index f00c869..ca2cbda 100644 --- a/src/m2_hello_world.py +++ b/src/m2_hello_world.py @@ -13,7 +13,7 @@ ######################################################################## # -# DONE +# 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 @@ ######################################################################## # -# DONE +# 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. # @@ -51,7 +51,7 @@ ######################################################################## # -# DONE +# 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 @@ -62,7 +62,7 @@ print("Hi there") ######################################################################## # -# DONE +# 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!). @@ -76,7 +76,7 @@ print(3607*34227) ######################################################################## # -# DONE +# 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 From 32199baec4bd359ac7d53f53e77fc2eae2073f08 Mon Sep 17 00:00:00 2001 From: Cheryl Date: Mon, 27 Nov 2017 15:07:11 -0500 Subject: [PATCH 04/10] I created a SimpleTurtle that draws a red heart --- src/m3_turtles.py | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/src/m3_turtles.py b/src/m3_turtles.py index 0f4920a..95b31d4 100644 --- a/src/m3_turtles.py +++ b/src/m3_turtles.py @@ -14,7 +14,7 @@ """ ######################################################################## # -# 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 @@ -60,24 +60,30 @@ # ---------------------------------------------------------------------- # Ask the SimpleTurtle objects to do things: # ---------------------------------------------------------------------- + +dave.speed = 20 +dave.pen = rg.Pen('green', 5) dave.forward(100) dave.left(90) dave.forward(200) + + # ---------------------------------------------------------------------- # Construct a new turtle and ask it to do things. # ---------------------------------------------------------------------- + matt = rg.SimpleTurtle('turtle') -matt.pen = rg.Pen('red', 30) -matt.speed = 10 # Faster -matt.backward(50) +matt.pen = rg.Pen('blue', 5) +matt.speed = 30 # Faster +matt.backward(100) matt.left(90) -matt.forward(50) +matt.forward(200) ######################################################################## # -# 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. @@ -91,7 +97,7 @@ ######################################################################## # -# TODO: 4. +# DONE: 4. # The code above CONSTRUCTS two SimpleTurtle objects and gives those objects NAMES: # dave matt # @@ -109,10 +115,24 @@ # As always, test by running the module. # ######################################################################## - +Cheryl = rg.SimpleTurtle() +Cheryl.speed = 10 +Cheryl.pen = rg.Pen('red', 3) +Cheryl.left(45) +Cheryl.forward(90) +Cheryl.left(75) +Cheryl.forward(40) +Cheryl.left(100) +Cheryl.forward(55) +Cheryl.right(75) +Cheryl.forward(55) +Cheryl.left(105) +Cheryl.forward(40) +Cheryl.left(65) +Cheryl.forward(85) ######################################################################## # -# 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. # From ba22ca745814936aeac629c4f504e2841426190b Mon Sep 17 00:00:00 2001 From: Cheryl Date: Mon, 27 Nov 2017 18:17:22 -0500 Subject: [PATCH 05/10] I changed window.delay value --- src/m3_turtles.py | 2 +- src/m5_your_turtles.py | 28 ++++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/m3_turtles.py b/src/m3_turtles.py index 95b31d4..67534f0 100644 --- a/src/m3_turtles.py +++ b/src/m3_turtles.py @@ -50,7 +50,7 @@ # TurtleWindow is in the rg (shorthand for rosegraphics) module. # ---------------------------------------------------------------------- window = rg.TurtleWindow() -window.delay(20) # Bigger numbers mean slower animation. +window.delay(10) # Bigger numbers mean slower animation. # ---------------------------------------------------------------------- # Makes (constructs) a SimpleTurtle object. diff --git a/src/m5_your_turtles.py b/src/m5_your_turtles.py index d9de2a6..5ae1432 100644 --- a/src/m5_your_turtles.py +++ b/src/m5_your_turtles.py @@ -2,10 +2,10 @@ 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 Cheryl He. """ ######################################################################## -# TODO: 1. +# DONE: 1. # On Line 5 above, replace PUT_YOUR_NAME_HERE with your own name. ######################################################################## @@ -28,3 +28,27 @@ # # Don't forget to COMMIT your work by using VCS ~ Commit and Push. ######################################################################## +import rosegraphics as rg +window = rg.TurtleWindow() +window.delay(10) +size = 200 +Cheryl = rg.SimpleTurtle() +Cheryl.speed = 10 +Cheryl.pen = rg.Pen('red', 3) +Cheryl.left(45) +Cheryl.forward(90) +Cheryl.left(75) +Cheryl.forward(40) +Cheryl.left(100) +Cheryl.forward(55) +Cheryl.right(75) +Cheryl.forward(55) +Cheryl.left(105) +Cheryl.forward(40) +Cheryl.left(65) +Cheryl.forward(83) +Cheryl.left(81) +for k in range(5): + Cheryl.draw_regular_polygon(5,size) + size = size - 20 +window.close_on_mouse_click() \ No newline at end of file From e183f9b29405068f8cbb5d98d8a8117bed358899 Mon Sep 17 00:00:00 2001 From: Cheryl Date: Mon, 27 Nov 2017 20:03:20 -0500 Subject: [PATCH 06/10] I created heart() that can draw 3 ugly hearts --- src/m5_your_turtles.py | 85 ++++++++++++++++++++++++++++++++---------- 1 file changed, 66 insertions(+), 19 deletions(-) diff --git a/src/m5_your_turtles.py b/src/m5_your_turtles.py index 5ae1432..129a3e6 100644 --- a/src/m5_your_turtles.py +++ b/src/m5_your_turtles.py @@ -30,25 +30,72 @@ ######################################################################## import rosegraphics as rg window = rg.TurtleWindow() -window.delay(10) -size = 200 -Cheryl = rg.SimpleTurtle() -Cheryl.speed = 10 -Cheryl.pen = rg.Pen('red', 3) -Cheryl.left(45) -Cheryl.forward(90) -Cheryl.left(75) -Cheryl.forward(40) -Cheryl.left(100) -Cheryl.forward(55) -Cheryl.right(75) -Cheryl.forward(55) -Cheryl.left(105) -Cheryl.forward(40) -Cheryl.left(65) -Cheryl.forward(83) -Cheryl.left(81) +window.delay(5) +up = 270 +half = 120 +full = 165 +down = 240 +adjust = 30 +Heart = rg.SimpleTurtle() + +def heart(up,half,full,down): + Heart.speed = 10 + Heart.pen = rg.Pen('red', 3) + Heart.left(45) + Heart.forward(up) + Heart.left(75) + Heart.forward(half) + Heart.left(100) + Heart.forward(full) + Heart.right(75) + Heart.forward(full) + Heart.left(105) + Heart.forward(half) + Heart.left(65) + Heart.forward(down) + +for k in range (3): + heart(up,half,full,down) + Heart.pen_up() + Heart.left(135) + Heart.forward(adjust) + Heart.pen_down() + Heart.right(90) + up = 0.7 * up + half = 0.7 * half + full = 0.7 * full + down = 0.7 * down + adjust = 0.7 * adjust + + + + + + + + + + + +"""size = 200 +Heart = rg.SimpleTurtle() +Heart.speed = 10 +Heart.pen = rg.Pen('red', 3) +Heart.left(45) +Heart.forward(90) +Heart.left(75) +Heart.forward(40) +Heart.left(100) +Heart.forward(55) +Heart.right(75) +Heart.forward(55) +Heart.left(105) +Heart.forward(40) +Heart.left(65) +Heart.forward(83) +Heart.left(81) for k in range(5): - Cheryl.draw_regular_polygon(5,size) + Heart.draw_regular_polygon(5,size) size = size - 20 + """ window.close_on_mouse_click() \ No newline at end of file From 27036045e5a096d280afc98af777ff18b9a547e2 Mon Sep 17 00:00:00 2001 From: Cheryl Date: Mon, 27 Nov 2017 20:15:00 -0500 Subject: [PATCH 07/10] I added a loop that draws 3 hearts to form a flower(yes that is a flower). --- src/m5_your_turtles.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/m5_your_turtles.py b/src/m5_your_turtles.py index 129a3e6..8fe1734 100644 --- a/src/m5_your_turtles.py +++ b/src/m5_your_turtles.py @@ -10,7 +10,7 @@ ######################################################################## ######################################################################## -# 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.) @@ -37,9 +37,9 @@ down = 240 adjust = 30 Heart = rg.SimpleTurtle() +Heart.speed = 30 def heart(up,half,full,down): - Heart.speed = 10 Heart.pen = rg.Pen('red', 3) Heart.left(45) Heart.forward(up) @@ -67,8 +67,16 @@ def heart(up,half,full,down): down = 0.7 * down adjust = 0.7 * adjust +Heart.pen_up() +Heart.right(90) +Heart.forward(300) +Heart.right(180) +Heart.pen_down() +Heart.right(90) - +for k in range (3): + heart(up,half,full,down) + Heart.right(75) From 09345c6d947c525667d3b593d7eda45748194e96 Mon Sep 17 00:00:00 2001 From: Cheryl Date: Mon, 27 Nov 2017 20:17:55 -0500 Subject: [PATCH 08/10] I added some comments --- src/m5_your_turtles.py | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/src/m5_your_turtles.py b/src/m5_your_turtles.py index 8fe1734..4f593e1 100644 --- a/src/m5_your_turtles.py +++ b/src/m5_your_turtles.py @@ -39,6 +39,7 @@ Heart = rg.SimpleTurtle() Heart.speed = 30 +# draw a heart def heart(up,half,full,down): Heart.pen = rg.Pen('red', 3) Heart.left(45) @@ -54,6 +55,7 @@ def heart(up,half,full,down): Heart.left(65) Heart.forward(down) +# draw 3 hearts in descending sizes for k in range (3): heart(up,half,full,down) Heart.pen_up() @@ -67,6 +69,7 @@ def heart(up,half,full,down): down = 0.7 * down adjust = 0.7 * adjust +# move the arrow down Heart.pen_up() Heart.right(90) Heart.forward(300) @@ -74,36 +77,9 @@ def heart(up,half,full,down): Heart.pen_down() Heart.right(90) +# draw 3 hearts as a flower for k in range (3): heart(up,half,full,down) Heart.right(75) - - - - - - - -"""size = 200 -Heart = rg.SimpleTurtle() -Heart.speed = 10 -Heart.pen = rg.Pen('red', 3) -Heart.left(45) -Heart.forward(90) -Heart.left(75) -Heart.forward(40) -Heart.left(100) -Heart.forward(55) -Heart.right(75) -Heart.forward(55) -Heart.left(105) -Heart.forward(40) -Heart.left(65) -Heart.forward(83) -Heart.left(81) -for k in range(5): - Heart.draw_regular_polygon(5,size) - size = size - 20 - """ window.close_on_mouse_click() \ No newline at end of file From 30d67e95fba24adb10fb24c4b8aa77aa4417363e Mon Sep 17 00:00:00 2001 From: Cheryl Date: Thu, 30 Nov 2017 14:12:41 -0500 Subject: [PATCH 09/10] I added some comments --- src/m5_your_turtles.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/m5_your_turtles.py b/src/m5_your_turtles.py index 4f593e1..24cc008 100644 --- a/src/m5_your_turtles.py +++ b/src/m5_your_turtles.py @@ -40,7 +40,7 @@ Heart.speed = 30 # draw a heart -def heart(up,half,full,down): +def heart(up, half, full, down): Heart.pen = rg.Pen('red', 3) Heart.left(45) Heart.forward(up) @@ -57,7 +57,7 @@ def heart(up,half,full,down): # draw 3 hearts in descending sizes for k in range (3): - heart(up,half,full,down) + heart(up, half, full, down) Heart.pen_up() Heart.left(135) Heart.forward(adjust) @@ -79,7 +79,7 @@ def heart(up,half,full,down): # draw 3 hearts as a flower for k in range (3): - heart(up,half,full,down) + heart(up, half, full, down) Heart.right(75) window.close_on_mouse_click() \ No newline at end of file From 44173d880fb3c9a6cfea9f0f0d34044da118dea1 Mon Sep 17 00:00:00 2001 From: Cheryl Date: Thu, 30 Nov 2017 14:14:45 -0500 Subject: [PATCH 10/10] I added some comments --- src/m5_your_turtles.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/m5_your_turtles.py b/src/m5_your_turtles.py index 24cc008..495ecfb 100644 --- a/src/m5_your_turtles.py +++ b/src/m5_your_turtles.py @@ -29,7 +29,7 @@ # Don't forget to COMMIT your work by using VCS ~ Commit and Push. ######################################################################## import rosegraphics as rg -window = rg.TurtleWindow() +window = rg.TurtleWindow(500, 500) window.delay(5) up = 270 half = 120 @@ -39,6 +39,7 @@ Heart = rg.SimpleTurtle() Heart.speed = 30 + # draw a heart def heart(up, half, full, down): Heart.pen = rg.Pen('red', 3) @@ -55,8 +56,9 @@ def heart(up, half, full, down): Heart.left(65) Heart.forward(down) + # draw 3 hearts in descending sizes -for k in range (3): +for k in range(3): heart(up, half, full, down) Heart.pen_up() Heart.left(135)