PictureWorld is an environment for composing geometric pictures from simple primitives. Here is a summary of the available functions, which will be explained in class:
Start by downloading and opening PictureWorld.zip. Right-click on this link and save it in your account folder ("guestXX" with the little house next to it). Then, use the finder to navigate to the folder "PictureWorld" within your account folder.empty - the empty picture patch(c) - a rectangular patch of color c tri(c) - a triangle of color c turn(p) - rotate picture p 90 degrees clockwise unturn(p) - rotate picture p 90 degrees counterclockwise turn180(p) - rotate picture p 180 degrees flipLR(p) - mirror picture p about vertical axis (flip left/right) flipTB(p) - mirror picture p about horizontal axis (flip top/bottom) flipDiag(p) - mirror picture p about diagonal axis beside(p1, p2) - arrange picture p1 to the left of picture p2 above(p1, p2) - arrange picture p1 above picture p2 overlay(p1, p2) - arrange picture p1 on top of picture p2


![]() | ![]() | |
|
|
Divide, Conquer, and Glue
The key to solving this problem is to note that the picture can be decomposed into smaller pictures that are used more than once in the larger picture. For example, the upper right quadrant is a picture that we'll call yellowCorner:

The whole picture can be decomposed into four copies of yellowCorner that have different rotations. Once we figure out how to define the yellowCorner picture, we can combine four rotated copies of the picture to form the desired quilt picture. This is an excellent illustration of the important divide, conquer, and glue problem solving strategy:
But how do we solve the problem of defining the yellowCorner picture? By applying the divide, conquer, and glue strategy again! In this case, yellowCorner naturally decomposes into two pictures:
![]() |
![]() | |
|
|
Here are the divide, conquer, and glue steps in this case:
We can continue to use divide, conquer, and glue to decompose the pictures into smaller and smaller pictures. When does the process stop? When we get to pictures so small that they are trivial to solve! In this case the trivial pictures are those generated by the patch(c) and tris(c1, c2) functions.
Auxiliary Functions
A general principle of computer science is "never write any piece of code more than once". If you find yourself writing the same or similar code more than once in your program, you should instead write functions that capture the patterns of the repeated code and use the functions instead. In class I will suggest some functions that will come in handy for this pattern

The only primitive pictures you should need are the empty picture and the picture generated by the tris(c1, c2) function. You can combine these via PictureWorld functions and auxiliary functions to construct the above picture.