User Tools

Site Tools


spcs:summer2014:d6

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
spcs:summer2014:d6 [2014/07/22 12:00]
ffpaladin
spcs:summer2014:d6 [2014/07/22 17:18]
ffpaladin [Part 4 - JS Platformer (Teams, if you have time)]
Line 17: Line 17:
   * http://​pixelartor.com/​   * http://​pixelartor.com/​
   * http://​hereistoday.com/​   * http://​hereistoday.com/​
 +
 +Non Animating Sort
 +
 +<code java>
 +
 +
 +// GLOBAL VARIABLES
 +
 +
 +int [] array = {90,​60,​70,​50,​40,​30,​20,​10,​1,​80};​
 +
 +// int i, j, k, l;
 +
 +// SETUP FUNCTION - Runs Once
 +
 +void setup () {
 +
 +  size(500,​500);​
 +  ​
 +  int min = 0;      // index of the array
 +  ​
 +  ​
 +  // outer for-loop
 +  for (int i=0; i<10; i++) {
 +    ​
 +    min = i;
 +    ​
 +    // inner for-loop
 +    for (int j=i; j<10; j++) {
 +      if (array[j] < array[min])
 +        min = j;
 +    }
 +    ​
 +    // swapping
 +    int temp = array[i];
 +    array[i] = array[min];
 +    array[min] = temp;
 +  }
 +  ​
 +  for (int k=0; k<10; k++)
 +    println(array[k]);​
 +   
 +}
 +
 +
 +// DRAW LOOP - Infinite Loop
 +
 +void draw () {
 + 
 +  background(255,​0,​0);​
 +
 +  ellipse(mouseX,​ mouseY, 20, 20); 
 +}
 +
 +</​code>​
 +
  
 Ball Code Ball Code
Line 98: Line 154:
 ===== Part 2: Visual Sorting II. Spend 20-30 min (Yesterday Teams) ===== ===== Part 2: Visual Sorting II. Spend 20-30 min (Yesterday Teams) =====
  
-Option 1: For those who've not gotten their sorts working, here's my selection sort from class. It's a little buggy: http://​pastebin.com/​hVFvXvD2+**Option 1:** For those who've not gotten their sorts working, here's my selection sort from class. It's a little buggy: http://​pastebin.com/​hVFvXvD2
  
-Option 2: If you are done your sort, take the beginning of class to add the following to the sort program:+**Option 2:** If you are done your sort, take the beginning of class to add the following to the sort program:
   - A Pause Button   - A Pause Button
   - A Start Button   - A Start Button
   - A Reset Button   - A Reset Button
  
-Option 3: If you'd rather work on your Seurat (Pixel Splotches), then you can create a way to change the ellipse sizes while within the program.+**Option 3:** If you'd rather work on your Seurat (Pixel Splotches), then you can create a way to change the ellipse sizes while within the running ​program.
  
 Remember, if your partner is done with the project, to Fork it into your own directory. Forking will allow you to continue the project on your own. You can keep a copy for yourself. Remember, if your partner is done with the project, to Fork it into your own directory. Forking will allow you to continue the project on your own. You can keep a copy for yourself.
 +
 +Everything on gh-pages!
  
 ---- ----
Line 181: Line 239:
  
 </​code>​ </​code>​
 +
 +----
  
 ===== Part 4: Processing (Today Teams) - Around the world for Mousey ===== ===== Part 4: Processing (Today Teams) - Around the world for Mousey =====
Line 198: Line 258:
 ==== Step 2: An object that has x and y ==== ==== Step 2: An object that has x and y ====
  
-Try to see if you can create objects like you did above.+Try to see if you can create objects like you did for the ball classes.
  
 ==== Step 3: Adjacency Matrix ==== ==== Step 3: Adjacency Matrix ====
Line 208: Line 268:
 Using some algorithm... Maybe Breadth First Search, draw a path that on the screen that highlights what's going on in the code. See example of lines above. Using some algorithm... Maybe Breadth First Search, draw a path that on the screen that highlights what's going on in the code. See example of lines above.
  
-==== Step 5: Travelling ​Sales Person ====+REMINDER: Shortest Path is NOT the Traveling Sales Person problem. TSP is much harder. You do not have to return home like the image above. 
 + 
 +==== Step 5: Traveling ​Sales Person ​(Optional) ​====
  
 Find the shortest distance that Mousey can go INCLUDING his return home. Find the shortest distance that Mousey can go INCLUDING his return home.
Line 220: Line 282:
 ---- ----
  
-===== Part - JS Platformer =====+===== Part - JS Platformer ​(Teams, if you have time) =====
  
 Cookbook! You know what to do. Cookbook! You know what to do.
/soe/sherol/.html/teaching/data/pages/spcs/summer2014/d6.txt · Last modified: 2014/07/22 17:18 by ffpaladin