Target
Create a Python program that defines the
function draw_target(center_x, center_y, radius)
.
The function should use the turtle module to draw a series of 3
concentric circles centered with alternating color at the
specified x and y location. The radius of each inner circle
decreases by 1/3 of the original radius each time.
Example

X
Create a Python program that defines the draw_x(center_x,
center_y, size, thick)
. The function should use the
turtle module to draw an X centered at the specified x and y
location. The width and height of the X is determined by
the size parameter and the thickness of the lines is
specified by the thick parameter.
Example

Pixel Art
Early computers had such a low resolution that you could see the the pixels, or squares, that made up the images. Modern computers are capabile of displaying smooth, detailed graphics. But blocky pixel art style remains popular. Creating retro pixelated visuals requires drawing filled-in squares. This is a great use for functions.
Details
Create a Python program that defines the function
draw_square(center_x, center_y, size, color)
. The
function should use turtle graphics to draw a square centered on the
point (*center_x*, *center_y*). The square should be *size* wide
and *size* tall. And finally it shold be filled with *color*.
A great benefit of functions is that present an opportunity to test an isolated portion of your program before it is completed. Take adantage of this to test the function before moving on.
Once you have tested the function and are satisfied that it works, use it to create a drawing of a checker board.
Example

- The center_x and center_y parameters to the function specify the center of the square. You need to move the turtle half of the size in both the x and y directions to center the square before drawing.
- Drawing the square is pretty easy, you just need to go forward and turn right 4 total times.
-
Use
the
color
function to set the fill color. And use thebegin_fill
andend_fill
functions to actually fill the square.
Challenge
The checkerboard is easy to draw but not very fun. Use the function to create some better pixel art. Use a Google Image Search for some suggestions. Email me your code, and I will include it in this activity for next year's class so students can use it to test their function.