1. Imperative programming
Week 1 (August 25)Due: 1.1. Turtle lab
👋 Welcome to LAI 676!
Notes
- Hello, welcome!
- About me
- Goals for the course
- content knowledge (learning CS)
- pedagogical content knowledge (learning how CS is learned and taught)
- Hardware
- Need a real computer
- Structure
- Units, labs, problem sets
- Weekly small group meetings
- Weekly lectures
- Weekly journal
- How to get help
- email me
- attend office hours with Varun (will send out survey soon)
- ask at your small group meeting
- ask in the discord
- AI - try to avoid... remember, one of the goals is to learn to code!
- Review the syllabus
💻 Do Now
- Make sure you have a computer you can use for the course
- Join our class Discord server
- Introduce yourself on Discord in the
#general
channel - Find a group who can all meet at the same time in-person or virtually
- Introduce yourself on Discord in the
- Get set up
- Work on the Turtle Lab
- due by next Monday
- Create a journal document and share it with me (eqbrown@buffalo.edu)
- Optional: Install Oh My Zsh for a more readable, colorful Terminal
Setup
This video guides you through the setup instructions.
Your username is your UB username - mine would be eqbrown
. Your password is the first letter of your UB username and your UB ID number - for example e00234
. Â
Turtle Lab
This video walksthrough the Turtle lab. Feel free to watch the video or follow along with the text.
A few extra Turtle Commands
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 |