Run update21, if you haven't already, to create cs21/labs/04. Then cd into your cs21/labs/04 directory and create the python programs for lab 4 in this directory (we are not giving you starter files this time). And remember, handin21 looks for your lab 4 assignments in that cs21/labs/04 directory!
$ update21 $ cd cs21/labs/04 $ vim grid.py
Your programs are graded on both correctness and style. Please review
the comments regarding programming style on the main page.
Write a program called grid.py that asks the user to specify a line spacing, and then draws (using the Zelle graphics library ) a grid of horizontal and vertical lines with that spacing in a graphics window with dimensions 500x500.
Below are some screenshots from such a program.
$ python grid.py This program draws a grid of lines on the graphics window. Please enter the spacing you want below. grid spacing: 100
$ python grid.py This program draws a grid of lines on the graphics window. Please enter the spacing you want below. grid spacing: 25
$ python grid.py This program draws a grid of lines on the graphics window. Please enter the spacing you want below. grid spacing: 78
Winter is coming! :) Use the Zelle graphics library to draw a snowman.
Open a file called snowman.py and create a program that draws a snowman using the graphics library. Here are some guidelines to follow:
Write a program called soccer.py that draws a soccer field, based on mouse clicks from the user. Have the user click once for the left side of the field and once for the right side. Then draw a soccer field to scale. Also have the user click a few times to place some player positions (x's and o's) on the field (see images below).
Hints and tips:
Here are some screenshots from our soccer.py program.
Note: Extra Challenge Problems are not a part of the graded lab assignment, and are not required. Please do not attempt these problems until you have completed the required parts of this lab. Feel free to hand them in, but again, they are not graded.
For the grid program, write another program (subgrid.py) that divides each grid box into a 4x4 subgrid, using thinner lines and color. Also, allow for different x and y grid spacings.
For the soccer program, include all