Room 112: Software Development
  • Software Development Curriculum
  • CS In Entertainment
    • Fireworks
    • Historical Animation
    • Stop Motion
      • Original Stop Motion Video Instructions
    • Straight Ahead Animation
      • Comparing
      • Step 2: Adding Realism
        • Program Along With Video
    • How To Share Scratch project
    • Stick Figure Animation
      • Walking Stick Figures
      • Original Stick Figure Scene
        • How Will This be Graded?
    • Crowd Animation
      • Group Project
        • How will this be graded?
    • Fashion
      • Explainer Video / VĂ­deo Explicativo
        • Self Scoring Checklist
          • Complete the Student Self Grading Checklist When you are Done
      • Pattern Design
        • Notebook response
        • Program your Own Pattern
          • Pick at least TWO of these Extensions
      • Gees Bend Quilt Collage
        • Pattern Designer + Gees Bend
    • First Down Marker
      • Get Started With Code
      • Explain
    • Hispanic Heritage Activities
      • Sugar Skulls Research
      • Making Our Own program
      • Day of the Dead Mask Program
      • Coloring Pages
      • Ofrenda
        • Programming an Ofrenda
          • Ofrenda Scoring Checklist
    • Exploring Pen Tools
      • Straight Lines
      • Shapes
      • Snowflakes
    • Goal Line Technology
  • CS in Gaming
    • Make Code Arcade
    • What is a Game?
    • Flowcharting a Game
      • But What Game?
    • Try a Tutorial
    • Adding Animations
      • After You Complete the Tutorial
    • Games with a Message?
      • Before you code
    • Trivia Game: Grace Hopper
      • Keep Going
      • Keeping Score
  • Your Voice Is Power
  • HTML
    • My 1st Webpage
      • Title Tag
      • Body
      • Comments
      • What to Turn in
    • Color
      • Font Color
      • HTML Color Codes
      • Body Color
      • Headings
    • Images
      • One Line ASCII Art
      • Picture Files
    • Font Attributes
    • Links
    • Lists
    • WebPage #1: Hobby or Interest
    • WebPage #2: Vintage Computing
  • CSS
    • CSS Intro & File Set Up
    • Referencing External Style Sheet
    • CSS Declaration Examples
      • Testing Declaration Examples
      • Practice Before we Move Forward
      • CSS Image Examples
      • Formatting Hyperlinks
      • IFrame
      • Lists
    • CSS: Assignment #1
  • Text Based Programming
    • Pencil Code Intro
      • Basic Drawing
      • Pen Colors
      • Drawing with Circles
    • Dots & Fill
    • 1st Assignment: Adding Traits
    • Named Variable
    • Random & Repetition: Good Clean Fun
    • Getting Better at Repeating
    • Assignment #2: Orange Square Purple Circle
    • Symmetry
    • Fractals with Removal
      • Triangle
      • Fractal Programming
      • Assignment #3
      • Extension: More than 1 Turtle
    • Race Track
      • Custom Race Track
        • Two Turtles?
    • Hatch?
    • Pixel Challenges
  • Micro:Bit Programming
    • LED Screen
      • Light Levels
      • Animation
      • Sinking Boat
        • Boats 2- 6
        • Final Code
      • Unique Animation
        • Now Program Your Own
    • Radio
      • Micro:Bit Beacon Hunter
    • Activity and Motion
      • Network Notebook
        • Reading Code
      • Build Step Counter
    • Bag Alarm System
      • Planning:
      • Count Down Timer
      • Physical Design Scoring
      • Prototype Scoring
      • Prototype Demonstration Video
      • 2nd Block Groups
      • 3rd Block Groups
    • Fireflies Assignment
      • Native American Spirit Animal
      • Building a FireFly
        • What to turn in at this stage?
        • Review of Programming
      • UN Global Goal 15
      • Group Message & Video
      • Individual Assessment
        • How will this be graded?
      • Individual Write - Up
      • What to Turn In
    • Lighthouse Project
      • Light Sensor Lesson
      • Lighthouse Basic Signal
      • Attaching an LED
      • Designing your Lighthouse Signal
      • Attaching a Push Button Lesson
      • Attaching a Piezo Buzzer
        • I am going to regret this
      • Basic Lighthouse Design
        • Make a Plan
        • Program your Lighthouse
        • What to Turn in
    • 1st Design Project
      • Description of Problem
      • What should I do?
      • Make an Initial Physical Design
      • Write your Code
      • Client Communication
      • Build your Design
      • Install your Device
      • What to Turn In?
    • Strobe Lights
      • X & Y Coordinates increment
      • Nesting
      • Assignment & Extensions
    • Compass
      • Program a Compass
      • 8 Point Compass
      • 16 Point Compass
      • Navigation using Directions
        • Time
        • d= rt
        • What to Turn in
        • Bonus
    • Temperature Gauge
      • Temperature Alarm
      • What is a Breakboard with Headers
    • Collecting Data
      • Remote Control Data Collection
      • Try it with Gravity?
      • Population Trait Counter
        • Population Trait Counter Extensions
          • Step Counter
    • Micro:Pets
      • Happy
      • Mood Chance
      • Becoming Unhappy
      • Feeding & Playing
      • Building your Digital Pet
      • Customization and Extensions
      • What to Turn in
    • Practice Final Project
      • New Discovery
      • Thinking Like a Programmer
      • Creating the Boat "Sprite"
      • Moving the Boat Down
      • Programming a Move Procedure
      • How do we Get back up?
      • Now onto the fun part
    • Servo
      • Calibrate
      • Keep Exploring
    • Final Project
      • Make your Project
      • Project Board
  • Tech Writing
    • Rubric for Grading Tech Writing
    • Paper Craft Pumpkins
      • What to Turn in?
    • Paper Craft Flowers
      • What to Turn in?
    • Pod Production: Snowflake Paper Chains
      • Individual Snowflake Chain
      • Group Snowflake Chain
    • Smart Traffic Lights
    • Croc-Spotting Drones
    • Fujitsu Gymnastics
      • Written Responses
    • Program and Write
  • Computer Exploration
    • Basic Computer Skills
    • Excel Pixel Art
    • Tesselations
    • Super Heros
      • Hour of Code Activities
      • What to turn in??
      • Extensions
    • Nasa Moon 2 Mars
    • Emojis
    • Doodle for Google
    • Valentines E Card
    • PSWD: Solve by Acting Out
    • Wolf Sheep Predation
    • E-Pass
      • The Actual PASS
      • Design a Home Screen & Screen Navigation
      • Who Said Anything About a Video
        • DHS Logo Files
    • Truchet Tiles
      • Can you make them move on their own?
      • Can we make more interesting shapes?
  • ProblemSolving
    • Problem 1
    • Problem 2
    • Problem 3
    • Problem 4
    • Problem 5
    • Problem 6
    • Problem 7
    • Problem 8
    • Problem 9
    • Problem 10
    • Problem 11
    • Problem 12
      • Problem 12A
Powered by GitBook
On this page
  1. Text Based Programming

Getting Better at Repeating

PreviousRandom & Repetition: Good Clean FunNextAssignment #2: Orange Square Purple Circle

Last updated 2 years ago

Consider this drawing in pencil code. To program this flower we need to produce 9 "petals" that are the same color, width and general shape, but are pointing outward at different angles from the center. And this time the differences are not random!

Open a new penicl code (be sure to sign in and save) and use this code to create the stem. The last line of code sets the pen color to yellow, but because there is no movement AFTER this, nothing is acually yellow

speed 20
pen green
rt 10
fd 200
pen yellow, 10

Now let us figure out how to draw ONE petal of our flower. Insert this one line of code

fd 50

Now - using the turtles ability to move backwards in the same direction it moved forwards, let us get this turtle back to the "center" of our flower. Hint bk 50

Now - he needs to TURN and get ready to draw the next flower. Each petal of the flower is an equal distance from all the other petals. This means that each petal is drawn after we have turned the turtle, the same degree, for each one.

We are turning in a circle - (which is 360 degrees) and we have 9 petals. So after we draw each petal, we want the turtle to make a right turn that is 360 divided by 9 - so rt 360 / 9. In programing the division sybmol is the forward slash on the bottom row of your keyoard

Here is the code to draw TWO petals

fd 50
bk 50
rt 360 / 9
fd 50
bk 50

So you could just keep typing that over and over again - OR we can use the ability to REPEAT lines of code and make it easier

for petal in [1..9]

for petal in [1..9]
  move forward 50
  move backwards 50
  make a rt turn

Now change your flower to have 12 petals - you will need to change how many times you repeat from 9 to 12 AND change the number of degrees we turn from 360 / 9 to 360 divided by 12. Can you add a center to your flower? Can you add a second, shorter set of petals in a different color?

Now that you know how to draw a flower using angles and repitition, it is time to be creative. You can decide to stick with flowers OR lose the stems and draw stars or fireworks.

Your Program output should have at least the following:

http://share.pencilcode.net/home/dhkmc-mcgfwrightroom112-fancyFlower