Difference between revisions of "CSC103 Homework 5 2012"

From dftwiki3
Jump to: navigation, search
(Hints on how to start with this sketch)
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
--[[User:Thiebaut|D. Thiebaut]] 16:55, 29 February 2012 (EST)
 
--[[User:Thiebaut|D. Thiebaut]] 16:55, 29 February 2012 (EST)
 
----
 
----
 +
__NOTOC__
  
 
<br />
 
<br />
 
<bluebox>
 
<bluebox>
This homework is due on March 7th, 2012, at 9:00 a.m. in class.  You can (and are encouraged) to work on this homework in pairs.  If you work in pairs, you must find time to work together, and not allow one person to work on the program on his or her own.
+
This homework is due on or before March 7th, 2012, 9:00 a.m..  You can (and are encouraged) to work on this homework in pairs.  If you work in pairs, you must find time to work together, and not allow one person to work on the program on his or her own.  This homework will have to be submitted electronically.
 
</bluebox>
 
</bluebox>
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
 
=Processing Sketch=
 
=Processing Sketch=
 
<center><videoflash type="vimeo">37692609</videoflash></center><br />
 
<center><videoflash type="vimeo">37692609</videoflash></center><br />
Line 14: Line 21:
 
=Requirements=
 
=Requirements=
 
* Your sketch must generate the rectangles that we see in the back of the sketch.
 
* Your sketch must generate the rectangles that we see in the back of the sketch.
* The rectangles must touch
+
* The rectangles must touch each other.
* The rectangles must be of varying color
+
* The rectangles must be of varying color.
* The number of rectangles is up to you.  At least 10.
+
* The number of rectangles is up to you.  You need at least 10.
 
* Your sketch must display two columns of circles.
 
* Your sketch must display two columns of circles.
* The circles should fit inside the rectangles.  They can be smaller than the width of the rectangles
+
* The circles should fit inside the rectangles.  They can be exactly the width of a rectangle, or they can be smaller than the width.
 
* The circles can be of any color you want, but not the same color as the rectangle underneath them.
 
* The circles can be of any color you want, but not the same color as the rectangle underneath them.
 
* There should be two columns of circles, one to the left, one to the right.
 
* There should be two columns of circles, one to the left, one to the right.
Line 28: Line 35:
 
=Hints on how to start with this sketch=
 
=Hints on how to start with this sketch=
 
Here is how I would recommend you start:
 
Here is how I would recommend you start:
# generate rectangles that are stacked up one on top of the other.  You know how to generate a stack of circles (from the lab), so you should be able to generate a stack of rectangle.  By the way, the solutions for all the challenges from the Processing lab have been added at the bottom of the lab.  Check them out!
+
# generate rectangles that are stacked up one on top of the other.  You know how to generate a stack of circles (from the lab), so you should be able to generate a stack of rectangle.  By the way, the solutions for all the challenges from the [[CSC103_Processing_Lab |Processing lab]] have been added at the bottom of the [[CSC103_Processing_Lab#Solutions| lab]].  Check them out!
 
# Look at the sketch where you had to change the color of the circles in the lab.  Use this method to change the color of the rectangles.  You do not have to make them go from green to red, as in the video.  Figure out something that makes them go from one color to another.  Avoid white...
 
# Look at the sketch where you had to change the color of the circles in the lab.  Use this method to change the color of the rectangles.  You do not have to make them go from green to red, as in the video.  Figure out something that makes them go from one color to another.  Avoid white...
 
# Then generate a column of orange circles in the middle of the window, as you did in the lab.
 
# Then generate a column of orange circles in the middle of the window, as you did in the lab.
Line 38: Line 45:
 
# You're done!
 
# You're done!
  
=Submission=
+
=Submitting the Homework=
  
* Details of how to submit your program will be given later... stay tuned.
+
* For this homework you will not need to hand anything out in class.  Instead you will submit your homework on the Web.  You must do so '''at the latest''' just before coming to class on Wednesday.
 +
* When you are done with your sketch and are ready to submit it, do the following:
 +
* Add your name(s) at the top of your sketch, behind two slashes, as follows:
 +
 
 +
  '''// Alex Andra'''
 +
  '''// Malena Vlady'''
 +
  void setup() {
 +
      size( 600, 600 );
 +
      smooth();
 +
  }
 +
 +
  void draw() {
 +
  ...
 +
  ...
 +
 
 +
* Copy your sketch in its entirety to the clipboard.
 +
* Go to this URL: http://maven.smith.edu/~103b/submit5.htm
 +
* Enter the 2 letters that define your user Id (or the user Id of your partner) for the Wiki system in the box.
 +
* Paste your sketch in the text area
 +
* Click on the '''upload''' button.
 +
<br />
 +
<center>[[Image:CSC103UploadHomework5.png|600px]]</center>
  
 
<br />
 
<br />
  
 
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
 
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
 +
<onlydft>
 +
<code><pre>
 +
void setup() {
 +
  size( 500, 500 );
 +
  smooth();
 +
}
 +
 +
void draw() {
 +
  background( 200 );
 +
 
 +
  for ( int x=0; x < 500; x = x+20 ) {
 +
    fill( x/2, 255-x, 0 );
 +
    rect( 0, x, 500, 20 );
 +
    fill( 250, 200, 8 );
 +
    if ( mouseY < x ) {
 +
      ellipse( 20, x+10, 20, 20 );
 +
    }
 +
    else {
 +
      ellipse( 500-20, x+10, 20, 20 );
 +
    }
 +
  }
 +
}
 +
</pre></code>
 +
</onlydft>
 
[[Category:CSC103]][[Category:Homework]]
 
[[Category:CSC103]][[Category:Homework]]

Latest revision as of 16:29, 1 March 2012

--D. Thiebaut 16:55, 29 February 2012 (EST)




This homework is due on or before March 7th, 2012, 9:00 a.m.. You can (and are encouraged) to work on this homework in pairs. If you work in pairs, you must find time to work together, and not allow one person to work on the program on his or her own. This homework will have to be submitted electronically.






Processing Sketch



  • Run the video above. This is what your sketch needs to do.

Requirements

  • Your sketch must generate the rectangles that we see in the back of the sketch.
  • The rectangles must touch each other.
  • The rectangles must be of varying color.
  • The number of rectangles is up to you. You need at least 10.
  • Your sketch must display two columns of circles.
  • The circles should fit inside the rectangles. They can be exactly the width of a rectangle, or they can be smaller than the width.
  • The circles can be of any color you want, but not the same color as the rectangle underneath them.
  • There should be two columns of circles, one to the left, one to the right.
  • The length of the left column should be controlled by the position of the mouse.
  • Similarly for the right column of circles.
  • The left column must grow from the bottom up
  • The right column from the top down.

Hints on how to start with this sketch

Here is how I would recommend you start:

  1. generate rectangles that are stacked up one on top of the other. You know how to generate a stack of circles (from the lab), so you should be able to generate a stack of rectangle. By the way, the solutions for all the challenges from the Processing lab have been added at the bottom of the lab. Check them out!
  2. Look at the sketch where you had to change the color of the circles in the lab. Use this method to change the color of the rectangles. You do not have to make them go from green to red, as in the video. Figure out something that makes them go from one color to another. Avoid white...
  3. Then generate a column of orange circles in the middle of the window, as you did in the lab.
  4. Adjust the dimensions of the circles so that they each fall inside a rectangle.
  5. Adjust the locations of the circles so that they are close to the left of the window.
  6. Generate another column of circles and put them on the right side of the window.
  7. Once everything works well, make the display of the left column dependent on the location of the mouse.
  8. Adjust that solution so that it also controls the right-side column.
  9. You're done!

Submitting the Homework

  • For this homework you will not need to hand anything out in class. Instead you will submit your homework on the Web. You must do so at the latest just before coming to class on Wednesday.
  • When you are done with your sketch and are ready to submit it, do the following:
  • Add your name(s) at the top of your sketch, behind two slashes, as follows:
 // Alex Andra
 // Malena Vlady
 void setup() {
      size( 600, 600 );
      smooth();
 }

 void draw() {
 ...
 ...
  • Copy your sketch in its entirety to the clipboard.
  • Go to this URL: http://maven.smith.edu/~103b/submit5.htm
  • Enter the 2 letters that define your user Id (or the user Id of your partner) for the Wiki system in the box.
  • Paste your sketch in the text area
  • Click on the upload button.


CSC103UploadHomework5.png














...