0% found this document useful (0 votes)
311 views4 pages

Tracy's Turtle Programming Guide

The document contains Python scripts and quizzes about using the Turtle module to draw shapes and move a turtle named Tracy. The scripts include commands to draw shapes like circles, lines, rectangles and more using for loops. The quizzes ask questions about Turtle commands like forward, circle, and turning Tracy using angles to confirm understanding of how to program Tracy's movements and drawing.

Uploaded by

Shrestha Mishra
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
311 views4 pages

Tracy's Turtle Programming Guide

The document contains Python scripts and quizzes about using the Turtle module to draw shapes and move a turtle named Tracy. The scripts include commands to draw shapes like circles, lines, rectangles and more using for loops. The quizzes ask questions about Turtle commands like forward, circle, and turning Tracy using angles to confirm understanding of how to program Tracy's movements and drawing.

Uploaded by

Shrestha Mishra
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

SCRIPTS:

1.1.4 - Stretched Slinky:

for x in range(5):
circle(35)
forward(40)

1.2.4 - Shorter Dashed Line:

penup()
backward(200)
pendown()
for x in range(4):
forward(50)
penup()
forward(50)
pendown()

1.2.5 - Caterpillar:

penup()
forward(20)
pendown()
for x in range(5):
circle(20)
penup()
forward(40)
pendown()

2.1.5 - Rectangle:

for x in range(2):
forward(50)
left(90)
forward(100)
left(90)

2.1.6 - Columns:

penup()
backward(100)
left(90)
backward(200)
pendown()
for x in range(0, 2):
forward(400)
penup()
right(90)
forward(100)
right(90)
pendown()
forward(400)
left(180)
forward(400)
right(90)
forward(100)

2.2.5 - Row of Circles:


penup()
backward(200)
forward(10)
pendown()
for x in range(20):
circle(10)
penup()
forward(20)
pendown()

2.2.6 - Columns 2.0:

penup()
backward(100)
left(90)
backward(200)
pendown()
for x in range(0, 2):
forward(400)
penup()
right(90)
forward(100)
right(90)
pendown()
forward(400)
left(180)
forward(400)
right(90)
forward(100)

2.3.5 - Hexagon:

for x in range(0, 6):


forward(50)
left(60)

2.3.6 - 'X' Marks the Spot:

left(45)
for x in range(0, 4):
forward(100)
backward(100)
left(90)

2.3.7 - Circle Pyramid:

penup()
setposition(-200,-200)
for x in range(0, 3):
penup()
forward(100)
pendown()
circle(50)
penup()
left(90)
forward(200)
left(90)
forward(50)
for x in range(0, 2):
pendown()
circle(50)
penup()
forward(100)
left(180)
forward(150)
pendown()
circle(50)

QUIZZES:

1.1.2 - Intro to Tracy:

How would I tell Tracy to move forward 100 pixels? : forward(100)


When using the circle() command, what value do we put inside the parentheses? : The
radius of the circle
When Tracy is facing right, from what location does she start drawing her circle? :
The bottom of the circle

1.2.2 - Tracy's Grid World:

Where does Tracy always start in the grid world? : At the (0,0) coordinate in the
middle of the canvas
What are the dimensions of Tracy’s world? : 400x400 pixels
Which commands would move Tracy forward 100 pixels? : A & B
How far does Tracy need to move from the starting position to reach the right side
of the canvas? : 200 pixels
If you want Tracy to move forward 100 pixels without making a line, what set of
commands should you write? : (Since answer is multi-lined, it is written directly
below the question)
penup()
forward(100)

2.1.2 - Turning Tracy:

Tracy always starts facing which direction? : East


If Tracy is facing right, which of the following commands can be used to turn her
to face up? : A & C
If Tracy started facing right, which direction would she be facing after we ran the
following code? : Up

2.2.2 - For Loops:

Which of the following is NOT a reason for loops are useful when writing code? :
Loops let us make shapes of multiple sizes
The following loop draws 3 circles on the screen. If I wanted to alter this loop to
draw 10 circles, how many lines would my code be? : 3 lines
If Tracy starts at the left edge of the canvas and moves forward 50 pixels, how
many times will this code need to be repeated to have Tracy reach the right edge of
the canvas? : 8 times
Which lines of the code below will be repeated 4 times? : 3, 4, and 5
Why do certain words change color in Python? : To show that they are recognized as
key words

2.3.2 - Turning Tracy Using Angles:

If I use the command right(180), which way will Tracy turn? : She will turn around
The setposition() command moves Tracy to a coordinate and : Does not turn her
If you wanted Tracy to complete her command immediately, which speed value would
you use? : 0
If you want three circles to be drawn next to each other (as seen in the image
below), after drawing the first circle, how far would you need to move Tracy before
drawing the next circle? : The circle's diameter

Common questions

Powered by AI

Tracy can be positioned at the starting point (0,0 coordinate) on the canvas using the penup() and setposition() commands. This setup is significant because it standardizes the starting reference for drawing algorithms, ensuring consistency in executing patterns and aligning them correctly on the canvas. This approach is crucial when developing reusable code or functions that rely on a known starting point to maintain their intended shapes or patterns .

Using the penup() command before repositioning Tracy is practical to prevent drawing unwanted lines while moving to the next drawing sequence. This ensures the canvas only contains the intended shapes and patterns, maintaining clarity and avoiding messy output. Penup is crucial in complex drawings where paths need to be invisible .

Tracy's ability to turn using specific angle values enhances precision by allowing for exact control over directional changes. For instance, turning Tracy by angles such as 90 or 180 degrees is critical in forming precise geometric shapes like squares or rectangles. This control aids in the accuracy and repeatability of complex patterns, enabling more sophisticated designs with consistent and predictable results .

Setting the speed value to zero in Tracy’s world makes the commands execute immediately, which is beneficial for quickly viewing the final result of a script without waiting for each action to play out. This is particularly useful during debugging or demonstrations, where the focus is on the result rather than the process of drawing .

Color changes in a Python script indicate syntax highlighting, which helps programmers by differentiating elements such as keywords, variables, and other elements of the code. This is especially useful for beginners as it visually reinforces correct syntax and helps in debugging errors by highlighting typos or incorrect usage of Python’s built-in keywords .

When constructing a pattern like a row of circles, spacing between the circles is determined by the circles' diameter. After drawing a circle, Tracy needs to move forward by a distance equal to the circle's diameter to ensure the next circle is positioned correctly without overlapping, preserving the pattern's uniformity and accuracy .

The setposition() command moves Tracy to a specified coordinate on the canvas without turning her. This allows for precise repositioning without altering the current direction Tracy is facing, facilitating complex drawing sequences that require precise placements while maintaining the orientation .

Using loops in programming, such as for loops, allows for the efficient drawing of shapes by automatically repeating a task. In Tracy's world, for example, to draw multiple circles consecutively, you can use a for loop to execute the circle drawing command multiple times. This reduces the number of code lines needed and simplifies the process .

To program a loop for drawing a repetitive pattern such as a dashed line or spiral, factors like loop iteration count, step distances between dashes, line thickness, and angular changes must be considered. Additional considerations such as starting position, line alignment, and proportions relative to the canvas size ensure the resulting pattern aligns closely with design specifications. Fine-tuning these parameters is essential for replicating precise and aesthetically pleasing patterns .

Tracy’s world is constrained to dimensions of 400x400 pixels. This limitation affects drawing algorithms by requiring them to be designed with these boundaries in consideration to ensure that shapes and patterns do not exceed the canvas limits. Effective algorithms leverage this knowledge to optimize layouts and movements for efficiency and accuracy in representing intended designs within the available space .

You might also like