Monday, 30 May 2011

Project 3: Loop Metaphor

Project 3: Describing a programming term using a metaphor.

My Term: Loops
I chose to attempt to describe loops because I felt like it would be more of a challenge coming up with  metaphors for it than other terms, such as if/else or variable. It also allows for more interesting, perhaps unpredictable results.

Initial Ideas:
I was stumped on this for a while, but I knew I wanted to make something tangible, not something programmed or in video form as I believed this would assist the user to learn the term much more than if it were simply displayed on a computer. This would also provide a bit of a challenge for me, as I have never done anything like this before.
Eventually I came up with a couple of ideas, one being a music structure. You roll a marble down a spiral track, and as it is rolling down it taps little metal rods which in turn strike some central object that makes a noise, such as multiple glass tubes filled with different levels of water. After much thought I eventually dismissed this idea, as I would not have access to the resources for have the time for this rather ambitious project.
My second idea was to create a flip book (you flip each page quickly and you see an animation). I was immediately set on creating this, as a flip book is like a while loop in itself; while there is another page, flip it. It also allows for a second visual attempt at explaining what a loop is in the form of an animation.
Choosing exactly what to animate was the hardest part of this project. I knew I wanted something easily understandable while capturing the user’s interest with something unpredictable or shocking, so it wasn’t easily forgettable.
My final idea finally came to me when I heard about one of someone else’s ideas for their loop presentation – a computer animation of an acorn tree growing up, dropping seeds, growing again etc.
I decided to take this idea and make it more personal, by changing the tree to a person (specifically, female), the seed being impregnation, representing humanity reproducing. But there was one problem with this; where does it end? What is the condition to ‘get out’ of the loop?
I played around with a few ideas, but finally settled on a massive event that wipes out the Earth: a huge asteroid colliding with the Earth by chance.

Research:
Because I have had no experience making quality flip books, I explored the Internet for help. Sadly, I could not find any website that could tell me anything I didn't already know about flip books; you need many pages stuck together with the animation centered towards the other end of the book, so it is easily seen when the book is used.
I decided I would need decently durable paper for the book if there would be potentially many people using it, so I went to a printing store to see what they had. There I found a durable paper of nice thickness to use that I believed would be perfect for my project.

Development:
To make the animation I decided to use Adobe Photoshop, as it has a built in animation function that would help me create my frames. I spent roughly 3 hours drawing the animation to a standard that I could realistically (with time constraints) produce. Then I took these frames to a printing company, who printed my frames on the paper I desired (stated before). I then proceeded to cut out each individual frame, place a layer of tape over the flipping edge to further ensure the books survival during the exhibition, the stuck them all together. After all the frames were combined, I  added cardboard from the bottom around the side to the top, for aesthetic purposes and to try to stop the paper bending too much after many uses.


Response:
After allowing randomly selected people of whom I have had no contact with previously to use my metaphor, I obtained responses similar to the following:


"Its mean."


"It works well if you flip it the right way." 
- I should have indicated exactly how to flip it more clearly - though it might have just been that people felt that they shouldn't remove it from the exhibition table so they weren't experiencing it properly.


"A good metaphor."


"Its good; its pretty obvious as to what the idea is, you don't have to sit there watching it going 'what?'"










Fin 

Monday, 9 May 2011

Loop Discussion

For my project 3, I will be exploring how to teach someone about a coding technique. I chose to do loops, using a flipbook as my medium, as a flipbook itself is like a loop; while there is another page, flip it. And I plan to have an animation in the book that shows a loop as well.

http://www.openprocessing.org/visuals/?visualID=3520
This sketch utilizes a for loop inside a for loop

for (int i = 0; i < ballAmount; i++) {
    myBall[i].step();
 
    for (int j = 0; j < i; j++) {
      if (i != j) {
        float distBalls = dist(myBall[i].x, myBall[i].y, myBall[j].x, myBall[j].y);
 
        if (distBalls <= distance) {
          float lineWeight = 10/distBalls;
          stroke(lineWeight*5, lineWeight, lineWeight);
          strokeWeight(lineWeight);
          line(myBall[i].x, myBall[i].y, myBall[j].x, myBall[j].y);
        }
 
        if (distBalls <= radius) {
          myBall[i].setInc();
          myBall[j].setInc();
        }
      }
    }
  }

This code is saying that for each ball in the sketch, move it, then check the distance between that ball and every other ball, and if the distance between a different ball and the current ball being checked is less than or equal to (int distance = 100;), then draw a line between the balls, increasing the thickness depending on the distance between them.

The loop is the 'for' part. It means, repeat this code over and over again, changing one value every time, acting on that value in the code inside the loop (ending when some check becomes false e.g. j < i ).