# Outline for November 22, 2022

Assignment: Homework 4, due November 22, 2022

1. Turtle graphics
1. What turtle is; import turtle

2. Drawing a figure: a box with a hat [tbox.py]
1. Set up the window to draw in: Screen()
2. Create the turtle: Turtle()
3. Cursor for drawing
4. Move cursor forward: forward, backward()
5. Turn cursor: left(), right()
6. Wait for the window to close: mainloop()

3. Titles, background, and such [tfancybox.py]
1. Window
1. Color of the window background: background()
2. Title of the window: title()
2. Turtle, more properly called “pen”
1. Shape of the turtle: shape()
2. Speed of the drawing: speed()
3. Color of the drawn line: color()
4. Thickness of the line (pixels): pensize()
5. Hide the turtle: hideturtle()

4. Plotting points and graphing
1. Drawing lines: penup(), pendown()
2. Move turtle: setpos()
3. Write text: write()
4. Draw a dot at the current position: dot() [tchaosdots.py}]
5. Draw a line from the current position to another: goto() [tchaosline.py]

5. Curves in turtle
1. Drawing parts of a circle [tcircle.py]
2. Drawing a curve [tcurve.py]

6. Turtle race [turtlerace.py]
1. Create turtles
2. Create goals
3. Create die
4. Program structure:
1. Check to see if either turtle has reached its goal; if so, that turtle wins
2. If not, ask the player whose turn it is to roll the die (ie, press ENTER)
3. Select random number from die list
4. Advance turtle appropriately (multiply by LENGTH_OF_STEP)
5. Loop until someone wins

You can read a very good tutorial (and the turtle race) at https://realpython.com/beginners-guide-python-turtle

 Matt Bishop Office: 2209 Watershed Sciences Phone: +1 (530) 752-8060 Email: mabishop@ucdavis.edu
MHI 289I, Programming in Health Informatics
Version of November 22, 2022 at 3:36PM