Presentation is loading. Please wait.

Presentation is loading. Please wait.

Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/http://creativecommons.org/licenses/by-nc-

Similar presentations


Presentation on theme: "Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/http://creativecommons.org/licenses/by-nc-"— Presentation transcript:

1 Creative Commons Attribution Non-Commercial Share Alike License http://creativecommons.org/licenses/by-nc- sa/3.0/http://creativecommons.org/licenses/by-nc- sa/3.0/ Original Developer: Beth Simon, 2009 bsimon@cs.ucsd.edu

2 CSE8A Lecture 16 Read next class: read pg 202-207 and CHAPTER 8: 252-265 Get your clicker back up front! Midterm! BRING RED SCANTRON! –Covers material through today –Review session with Leo Tues 7-8:30pm location TBD –Sample midterm posted by tomorrow 7am: Use learning goals to know what I care about Redo: clicker questions, quizzes, lab quizzes, (75-80% ish Multi choice Be able to WRITE CODE ON PAPER (like your PSAs) –35 min individual (90%), 15 min group (10%)

3 By the end of today’s class you should be able to… LG34: Compare and contrast two solutions to a problem using for loops and if statements LG35: Be able to identify which pixels you want to check for chromakey

4 Honorable Mentions:

5 Best of Show

6 Quiz 4 Review/Midterm Review How would you call and display the flipped Picture? Picture changed = new Picture(p); p.mystery(changed); changed.show(); Picture changed = new Picture(); p.mystery(changed); changed.show(); Picture changed = new Picture(p); changed.mystery(p); changed.show(); Picture changed = new Picture(); changed.mystery(p); changed.show();

7 In Lab 5: How many times is the red line below executed? public void makeConvict() { for (int x = 0; x < this.getWidth(); x++) { for (int y = 0; y < this.getHeight(); y++) { Pixel currentPix = this.getPixel(x,y); if ( (currentPix.getGreen() > 200) && (y%2==0)) { currentPix.setColor(Color.BLACK); } else if( (currentPix.getGreen() > 200) && y%2 == 1) { currentPix.setColor(Color.WHITE); } A.width * height / 2 B.width * height C.width * height * 2 D.width * height * 1.5 E.Depends on the color of the Pixels in the picture REVIEW

8 In Lab 5: How many times is the red line below executed? public void makeConvict() { for (int x = 0; x < this.getWidth(); x++) { for (int y = 0; y < this.getHeight(); y++) { Pixel currentPix = this.getPixel(x,y); if ( (currentPix.getGreen() > 200) && (y%2==0)) { currentPix.setColor(Color.BLACK); } else if( (currentPix.getGreen() > 200) && y%2 == 1) { currentPix.setColor(Color.WHITE); } A.width * height / 2 B.width * height C.width * height * 2 D.width * height * 1.5 E.Depends on the color of the Pixels in the picture

9 In Lab 5: Which of these statements is true? public void makeConvict() { for (int x = 0; x < this.getWidth(); x++) { for (int y = 0; y < this.getHeight(); y++) { Pixel currentPix = this.getPixel(x,y); if ( (currentPix.getGreen() > 200) && (y%2==0)) { currentPix.setColor(Color.BLACK); } else if( (currentPix.getGreen() > 200) && y%2 == 1) { currentPix.setColor(Color.WHITE); } A.The red line of code is executed the same number of times as the purple line of code B.The red line of code is executed more times than the purple line of code C.The red line of code is executed fewer times than the purple line of code D.The relationship depends on the specific Picture that this code is run on

10 Original make convict bird: If it’s a green pixel AND it’s an even indexed row, make it black Else If it’s a green pixel AND it’s an odd indexed row, make it white If it’s a green pixel –If it’s an even indexed row, make it black –Else make it white Better version: Test Common Element Once Take advantage of “mutually exclusive”


Download ppt "Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/http://creativecommons.org/licenses/by-nc-"

Similar presentations


Ads by Google