Making with Code

Welcome to Making with Code! #

We’re glad you’re here! yay πŸ˜„

πŸ‘Ύ πŸ’¬ FYI

Here’s my first FYI: you will see πŸ’» throughout each lab.

This means that you need do something that involves writing code or using your Terminal. You can use these like little action items during labs.


[0] Your First Turtle Drawing #

πŸ’» Go to: bit.ly/day1_cs9. Experiment with turtle commands below.

Function Input Example Use Explanation
forward amount forward(100) Moves the turtle forward by the specified amount
backward amount backward(100) Moves the turtle backward by the specified amount
right angle in degrees right(45) Turns the turtle clockwise by the specified angle
left angle in degress left(45) Turns the turtle counter clockwise by the specified angle
color colorname color('red') Sets the color for drawing. Use “red”, “black”, etc. Here’s a list of all the colors.
speed number from 0-10 speed(0) Determines the speed at which the turtle moves around the window. 1 for slowest, 3 for normal speed, 10 for fast, 0 for fastest.
pendown None pendown() Puts down the turtle/pen so that it draws when it moves
penup None penup() Picks up the turtle/pen so that it doesn’t draw when it moves
pensize width pensize(4) Sets the width of the pen for drawing
setheading angle setheading(90) Sets the pen to the 0th degree
circle size circle(10) Sets the radius of the circle
goto x, y goto(90,0) Moves turtle to a given coordinate
begin_fill None begin_fill() Marks the start of the color fill
end_fill None end_fill() Marks the end of the color fill
fillcolor colorname fillcolor('purple') Sets the color of the fill

Error and Bugs #

While trying this out, you may come across errors or bugs, do not fear! Write the issue down, and we can talk about it during class. Try to figure out whether your bug is a:

Programmatic error (which happens when the program does something different than what you wanted. Remember that this happened when we set the angle to the wrong number)
Syntax error (which happens when the program crashes because the program cannot be understood by the computer. Remember that this happened when we forgot a parentheses).