Difference between revisions of "CSC103 Take-Home Final Exam Spring 2012"

From dftwiki3
Jump to: navigation, search
Line 1: Line 1:
 
<onlydft>
 
<onlydft>
 +
 +
=What to submit=
 +
 +
* You will need to type your answers in one single text file that you will then print and handout on the due date.
  
 
=Boolean Logic=
 
=Boolean Logic=
  
 
=Programming in Processing=
 
=Programming in Processing=
 
+
[[Image:CSC103ProcessingFinal2012.png|right|150px]]
 
==Initial Program==
 
==Initial Program==
 
* Copy/Paste this program into the Processing editor.
 
* Copy/Paste this program into the Processing editor.
 
<br />
 
<br />
 
<code><pre>
 
<code><pre>
 +
// declare a variable called diameter that will contain
 +
// real numbers.
 
float diameter;
 
float diameter;
 +
 
void setup() {
 
void setup() {
 
   size( 500, 500 );
 
   size( 500, 500 );
  frameRate( 30 );
 
 
   smooth();
 
   smooth();
 
}
 
}
  
 
void draw() {
 
void draw() {
 +
  // put a random number less than 200 into variable diameter
 
   diameter = random( 200 );  
 
   diameter = random( 200 );  
 +
 +
  // pick a color with a random amount of red, 100 units of green, and 200 units of blue
 
   fill( random(255),100, 200 );   
 
   fill( random(255),100, 200 );   
   for ( int i=0; i<10; i++ ) {
+
 
 +
  // draw 10 circles at random position in the window, with the same diameter.
 +
   for ( int i=1; i<=10; i++ ) {
 
       ellipse( random( 500 ), random( 500 ), diameter, diameter );
 
       ellipse( random( 500 ), random( 500 ), diameter, diameter );
 
   }
 
   }
Line 42: Line 53:
 
==Your Assignment==
 
==Your Assignment==
  
# make your sketch display circles only on the sketch only when the mouse button is ''pressed''.
+
# make your sketch display circles on the window only when the mouse button is ''pressed''.  If the mouse isn't pressed, nothing happens in the window
#  
+
# make the circles shrink in size if the mouse moves toward the left side of the window.  The circles will grow in size if the mouse moves toward the right side of the window.  The circles are still random in size, but their maximum size depends on the mouse position.
 +
# make the circles more random in color and not with this strong ''blue'' tint.  Moreover, instead of having 10 circles the same color every time ''draw()'' is called, make each of the 10 a different (random) color.
 +
 
 +
 
 +
 
 
=Assembly Language Program=
 
=Assembly Language Program=
  

Revision as of 15:18, 5 March 2012


...