You are on page 1of 13

Bell-ringer

• Draw 2 consecutive squares on IDLE and write


the pseudocode for how to draw those
squares.

**Create a new file for this and save it as


“Moving Squares”

1
2 Consecutive Squares Pseudocode
Call from turtle import *
Move forward 100 pixels
Turn left 90 degrees
Move forward 100 pixels
Turn left 90 degrees
Move forward 100 pixels
Turn left 90 degrees
Move forward 100 pixels
Move forward 100 pixels
Turn left 90 degrees
Move forward 100 pixels
Turn left 90 degrees
Move forward 100 pixels
Turn left 90 degrees
Move forward 100 pixels
Call Mainloop 2
2 Consecutive Squares
from turtle import *
forward(100)
left(90)
forward(100)
left(90)
forward(100)
left(90)
forward(100)
forward(100)
left(90)
forward(100)
left(90)
forward(100)
left(90)
forward(100)
mainloop () 3
Question of the Day

What if we want the separate the squares


with some space between them? What do
we need to know to this?

DRAFT & CONFIDENTIAL 4


Add penup(), pendown()

Add the code below between your 2 squares:

penup()
forward(100)
pendown()

DRAFT & CONFIDENTIAL 5


2 Separated Squares
from turtle import *
forward(100)
left(90)
forward(100)
left(90)
forward(100)
left(90)
forward(100)
penup()
forward(100)
pendown()
forward(100)
left(90)
forward(100)
left(90)
forward(100)
left(90)
forward(100)
mainloop () 6
What Happened?

DRAFT & CONFIDENTIAL 7


What if we want to GoTo a Specific
Place on the Screen instead?

Change “forward (100)” to “goto (150,150)”

penup()
forward(100)
pendown()

penup()
goto(150,150)
pendown()
DRAFT & CONFIDENTIAL 8
2 Random Squares
from turtle import *
forward(100)
left(90)
forward(100)
left(90)
forward(100)
left(90)
forward(100)
penup()
goto (150,150)
pendown()
forward(100)
left(90)
forward(100)
left(90)
forward(100)
left(90)
forward(100)
mainloop () 9
Let’s Do This!
Randomized Pairs
Paired Programming
Start with Pseudocode

With your new partners, open today’s assignment on Schoology


and write the pseudocode for drawing a stick person out of
polygons and 45-degree angle increments (45, 90, 135, 180, etc)

Skip the Spheres!

DRAFT & CONFIDENTIAL 12


Paired Programming

Decide who will Navigate and Who


will Drive! I will set the timer for 5
minutes.

Each time you hear it, switch jobs!

You might also like