Pretty Pictures

 

My favorite computer science project I worked on was my final project in Program Design (COMP 215). I made a web application using Java and JavaScript that used genetic algorithms to breed “Pretty Pictures.” This is one of my favorite pictures made by the application.

The first challenge that this project presented was representing images as trees of mathematical functions. The basic functions are x, y, and constants, each corresponding to a gradient along the x-axis, a gradient along the y-axis, and a solid color respectively. These could be combined into 1-argument functions (i.e. negation, sin, cos), which can then be combined into 2-argument functions (i.e. addition and subtraction), and even 3-argument functions (i.e. dissolve).

In total there were 27 functions, which would be combined at random to form a set of 20 starting images. The user of the application would then select at least 2 images they deem “pretty,” and then the function trees that represent these images would be bred together to create 20 new pictures. The method used for breeding was inspired by Karl Sims’ paper Artificial Evolution for Computer Graphics.

Screenshots of 23 consecutive "generations" of pictures

Below is a gallery of some of my favorite pictures I generated using this application:

                         

Other projects like this: Text-Based Adventure Game

← return home