WARMUP

The game Connect 4 has two players alternating turns dropping their tokens (differentiated by color) into a series of 7 columns, each of which is 6 rows high. When placed, the tokens fill the lowest open row in a column. A player wins when placing a token causes there to be 4 in a row of a particular color.

Write down the parts for a program of this game. Recall yesterday’s warmup if you want hints about what needs including.

HW Review

What did people have the most trouble figuring out? ask random

Programming

Thing big: what was this homework about? ask random

Key Python Ideas

Key Research Ideas

Advanced Version

Create a shapes.py in your homework directory, which should figure out side lengths from areas of CIRCLEs, SQUAREs, and equilateral TRIANGLEs, which behaves like:

$ ./shapes.py
... error indicating no input...
$ ./shapes.py OCTAGON 1.5
... error indicating unknown shape...
$ ./shapes.py TRIANGLE 17
equilateral TRIANGLE, area 17, side: ...
$ ./shapes.py SQUARE 8
SQUARE, area 8, side: ...
$ ./shapes.py CIRCLE 6
CIRCLE, area 6, radius: ...

When you have completed this, add it to your repository.

Project Advice

The shape drawing project requires similar capabilities to the extended version of the homework. Perhaps you want to reuse it? If you wrote in it a way that is re-useable (which you should know how to do from the homework), then feel free to do so.

HOMEWORK

Write program draw_shape.py, which defines a function that receives the shape type and area, and draw the corresponding shape. This script should import shapes to use the functions you defined earlier in class. You will also need to import some modules for shape drawing - ask a friend or the internet for advice about which ones and examples of how to use them.

When you have finished that, the file render_shapes.py (already implemented, no need to fiddle with it) should now work as follows:

$ ./render_shapes.py
... draws a series of shapes ...

The render_shapes.py file imports those other files, so you will need to examine it to know what function names to use.