Cs151 proj2 Matthew Willett-Jeffries
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Matthew Willett-Jeffries
Project 2

Colby image 1

This first image is of a log cabin positioned in the woods during a cloudy day

Colby image 2

This second image is a conceptual drawing of Hillside on a star lit night.

The pictures above are the final product of a series of code designed and intended to produce unique images from a basic set of functions.  For each picture I made use of a basic set of shapes, mostly a rectangle manufacturing function and a triangle function, and combined these elements to create more complex shapes and structures. Many of the shapes, such as the buildings, made use of mathematical variables to produce a consistent but manipulable image. In order to tackle random elements or create sleek natural images, the "random.randint(x,y)" function was used; this unique feature was applied on many levels of the code including the production of trees in the environment, compelling images of clouds, and the natural array of stars. Finally in order to draw a series of windows on each building while remaining relative to the buildings size a "for x in range(n)" function was used within itself so that a process of producing four windows could be repeated four times.

The final code made use of many complex shapes, such as the buildings, the trees and the windows, in which shapes previously defined in code were used to define and create more intricate shapes. Loop control was also used to repeat complex functions (which often themselves included loops) and the "turtle.color(x,y,z)" function played a prominent role in bringing each image to life. As mentioned above, in order to make many of the natural elements appear raw the "random.randint(x,y)" function was used to position different elements in a random array. Finally some of the unique elements of the images such as the shaded buildings were achieved by taking advantage of the turtle drawing system. For example, by leaving a shape open rather than closed the sleek shading on each building could be achieved with little actual code.

Though this project only expanded on the knowledge and tools introduced in the last project, it required a higher level of proficiency and understanding. By introducing new elements in the module array, such as the random module, and the use of color shading, and complex shapes, these tasked proved highly informative. Most of all, this project embedded in me a general understanding of modules, complex codes, and the proper ordering of code.

The program containing the defined shapes can be found under shapes2.py and the program designed to produce the images above can be found under Main.py.

  • No labels