Let there be light!
We have created light in the Visual World Investigate Lab…well kind of. Last night 13 visitors created a computer game to guide a beam of light through two dimensional space using mirrors and trigonometry (somewhere right now a high school math teacher is crying with joy) to light up a computer screen. Each person was given a partially completed program and instructions on how to create the game by adding in their own lines of code.
After about ten minutes of typing we had created a powerful seven lines of code and conquered the graphics window, displaying our own gaming window with an image of a 500 x 500 pixel grid. After creating the game window, we designed code that would allow us to place mirrors inside of the window. Each mirror required three inputs: an x position (horizontal location) and y position (vertical location) of the mirror and the angle we wanted to rotate the mirror. After a brief refresher on coordinate planes and rotation, we were throwing mirrors in that window left and right and rotating them from -360 to 360 degrees.
The goal of our game was to arrange the mirrors in a way to reflect a beam of light around obstacles and into a yellow light box. This is where it got really fun. Not one person solved the game the same way. Some played it safe with 45 degree angles. Others went crazy with negative degrees and near horizontal lines. The image at the bottom of this page is just one example of a winning method. Here is the funnest part though…while solving the problem each person learned a few principles of computer programming. We created variables, arrays, for loops, and more. Some people took it even further and started hacking our code. A few completed the game without using any mirrors by figuring out how to move the light box or remove the obstacles. Someone even went into the images and changed the light beam into a picture of a koala (seeing a koala bounce around mirrors is actually quite amusing). Learning some programming fundamentals and how to edit code can get you pretty far these days, and this is only the beginning
So, if this sounds fun to you (believe me, it is) check out our Thursday night classes (http://naturalsciences.org/programs-events). Twice a month we offer a class either in electronics or computer programming. We do something different each time, so it never gets old. Even you can make cool games like the one below.