Thursday, 26 May 2011

200-300 words plus Pseudocode


An If/Else statement is a man waiting to be woken up.

Instructions: Move the magnet up and down the box. If you put the magnet on the top of the box then the man is awake. But if you put the magnet on the bottom of the box then the man is sleeping ready to be woken once again buy the movement of the magnet.

An if/Else statement is a piece of code in a program that will run when something triggers it such as a movement, mouse click or a value etc. The statement has two parts to it an IF and an Else. When the statement has been triggered the program will check the statement to see if it should run the IF part of the statement or the Else part. This piece explains that an If statement is like a man ready to be woken up. It shows that an if statement is waiting in a pile of code ready to be triggered buy something which will make it run. In this instance the trigger is the magnet which wakes the man up or “runs the IF statement” or Else “It doesn’t run” and he stays asleep. The Man being awake represents the If statement running and the man lying down represents the else part of the statement.

Pseudocode
If (magnet=top of the box)
{
Man is awake;
}
Else
{
He is still sleeping;
}

Thursday, 19 May 2011

After presentation

After the presentation with the group and the class i have decided to choose my 2nd idea which is having a man in the glass or acyclic box and he will stand up if a magnet is put on the top of the box. I choose this idea because after my presentations the tutor and lecturer thought that this was a cool idea. I also chose this project because it would probably cost the least out of all the ideas because apart from the acyclic box I have all the resources I need to make this project.

Ideas for Presentation

Idea 1
 My first idea that came to mind for an If/else statement was to have a chain reaction. The model would start with an action which the user will do to stat the chain reaction. My metaphor would be something along the lines of If/else is the start of a process. I would start to explain that if the chain reaction is triggered then it is a process else it is still and not affecting the rest of the program. I would most likely use materials that I have easy access to I think that if was to buy something’s for this project it wouldn’t cost too much. I expect to spend about $20 on this project.

http://www.youtube.com/watch?v=Vh-4y4hS91k&feature=fvsr

Idea 2
The second idea that I had for an If/else statement was to have a model of a man in a glass or acrylic box and when you put a magnet on the top of the box he will stand up straight but if the magnet is not of the top of the box he will be at the bottom of the box. My metaphor for this idea would be If/else is a man in a box ready to be woken up. I would explain that if the magnet is on the top of the box the man is standing else he is lying or sitting down. The materials I would use would be either glass or acrylic for the box and paper or a fabric for the man and magnets to get the man to stand up. The magnets will be attached to the man so when another magnet is on top of the box the man will stand up. I think that I would spend about 20 on all of these materials most likely I would spend less.






Idea 3
My third idea for the If/else statement was to have a small door which you can not open until you unlock it. I would have the key sitting in front of the door and then the user can pick it up and unlock the door. My metaphor for this idea would be An If/Else statement is a door ready to be unlocked. I would explain that an if statement only starts to work if something specific happens in the project to set it off which is exactly like a locked door (the door is only open if the door is unlocked). The material I would use for this idea would be some wood for the door which I will be able to make, a small locking mechanism which would go in the door and will be able to lock and unlock the door and I would also need to make a key. I think I could make the door out wood and the rest out of some sort of metal or wire. I think that all the materials I will need would cost around $20. 


Monday, 9 May 2011

Research on If/Else 3rd

int counter=0;
int shrink=0;
int side=0;
int up=0;
int timing=10;


void setup()
{
 
  background(127);
  size (500,500);
  stroke(0);
}
void draw()



{
 
rect(counter,50,50,50);
counter= counter +1;

if (counter>timing)
{
rect(50,shrink,50,50);
shrink= shrink +1;

if (shrink>timing)
{rect(side,400,50,50);
side= side +1;

if (side>timing)
{rect(400,up,50,50);
up= up +1;}}}

}

Thursday, 5 May 2011

Research on If/Else 2nd

Link-http://www.openprocessing.org/visuals/?visualID=15768

if (keyCode == RIGHT) rightPressed = true;
  if (keyCode == LEFT)  leftPressed = true;
  if (keyCode == UP) {
    upPressed = true;
  }
  if (keyCode == 82) reset = true;

Research on If/Else 1st

Link -http://www.openprocessing.org/visuals/?visualID=3148

 










if( mousePressed )
    {

      PVector dir = new PVector( mouseX, mouseY, -500 );
      dir.sub( loc );

      dir.normalize();
      speed.add( dir );

    }
    else

    {
      speed.mult( .9 );

    }
    loc.add( speed );

    pushMatrix();
    translate( loc.x, loc.y, loc.z );

    rotateToFace( loc );
  

    beginShape( QUADS );
    vertex( -size, -size, 0 );

    vertex( size, -size, 0 );
    vertex( size, size, 0 );

    vertex( -size, size, 0 );
    endShape();

    popMatrix();

Description of the If/Else


         If
  • Allows the program to make a decision about which code to execute. If the test evaluates to true, the statements enclosed within the block are executed and if the test evaluates to false the statements are not executed.

        Else
  • Extends the if() structure allowing the program to choose between two or more block of code. It specifies a block of code to execute when the expression in if() is false.

Start of Project 3

My term that I have chosen to do is If/else. My original idea that I had in my head was to create a chain reaction which would trigger and start the chain reaction if somebody was to push,pull,twist or touch the beginning of the chain reaction. I would explain that this is like an if/else statement, If somebody starts the chain reaction it is moving / else it is not. I haven't got my metaphor together yet. 

Monday, 2 May 2011

Link to final

This is the link to my Final Transformation program


http://www.openprocessing.org/visuals/?visualID=27974

feedback after presentation

After my presentation on the last day I got feedback from my fellow class mates.

Some of the feedback I got was:


"You should make it so that you can catch the balls when they are bouncing"

"I really like the image that it creates and how it transforms constantly as the program runs"

"Maybe you should make it more simpler. Only use one sound so it doesn't complicate things"

The feedback that I got is very useful and I hope to incorporate all the things that were said during the holidays