Do something on the web about the web
For my final project, I coded a program using Java that paints random night skies. I learned the basics of Java in high school, but I haven’t coded anything in over two years. I thought this project would be the perfect opportunity for me to refresh my coding skills and create something new. I decided I wanted to code a program that paints night skies. Looking at the stars at night makes me think of the infinite unknown, as does the web. This course introduced me to so many new aspects of the internet, and yet my knowledge is still limited to only the smallest fraction of the holistic web. I thought the night sky would be the perfect artistic representation of the web because of its seemingly infinite expanse.
I knew exactly what I wanted my end product to be when I began coding. From the computer science class I took junior year of high school, I learned that having a clear end vision is crucial to programming. However, figuring out how to execute my vision was not easy. I quickly learned that I did not remember much about coding, so the first few hours of working on my project consisted of me researching Java to refresh my memory. I downloaded drJava, the program I used in high school, and got to work.
The first time I tried to run the program, it wouldn’t compile and I got 13 error messages; I was soon reacquainted with the frustrations of debugging code. After more research and learning about how I accidentally set integers as doubles, didn’t import the right packages, and had syntax errors throughout, I got the program to compile. In the PowerPoint of my documentation, I included a screenshot of what my program looked like the first time it ran. It was far from complete, but just getting the program to work was the biggest obstacle I had to overcome. The initial program just generated a random number of circles with random colors and locations; these would eventually become the planets in my night sky.
Next, I had to code the stars. This was much more difficult than the planets because I couldn’t just g.fillOval them as I did with the planets. I had to figure out how to create randomly spawning intersecting lines, which involved a bit of math. In my PowerPoint I added screenshots of a couple of my failed attempts at creating stars- it took me numerous trials to figure out how to get it right, but that’s how coding usually goes. Once I got it right, I spent time tweaking the program so it looked the way I wanted it (making the planets and stars smaller, adding more stars, taking away some planets). The program is still randomized though, just with the parameters I picked out, so each time it is run it generates a completely new painting.
Here is my code:
And here are some pictures of what the program looks like when it runs.
This isn’t a complex or beautiful program, but it does exactly what I wanted it to do. I loved the idea of creating art that’s made partially by me and partially by a computer. I made the code and set the parameters, and the computer randomized and painted it. Art has evolved tremendously in the past 30 years as computers are now one of the most popular mediums for creating art. Typically, computers are just used as a tool or a canvas for the artist. But since I am not an artist, I wanted to write a program that painted itself.