Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 115 Week 12 March 31 – April 4, 2008. Announcements March 31 – Exam 8 March 31 – Exam 8 April 6 – Last day to turn in Lab 7 for a max grade of 100%,

Similar presentations


Presentation on theme: "CSE 115 Week 12 March 31 – April 4, 2008. Announcements March 31 – Exam 8 March 31 – Exam 8 April 6 – Last day to turn in Lab 7 for a max grade of 100%,"— Presentation transcript:

1 CSE 115 Week 12 March 31 – April 4, 2008

2 Announcements March 31 – Exam 8 March 31 – Exam 8 April 6 – Last day to turn in Lab 7 for a max grade of 100%, last dayt to turn in Lab 8 for a 20% bonus. April 6 – Last day to turn in Lab 7 for a max grade of 100%, last dayt to turn in Lab 8 for a 20% bonus. April 7 – Exam 9 April 7 – Exam 9 April 10 – Last day to turn in Lab 7 for any credit, last day to turn in Lab 8 for extra credit presentations, Milestone build 1 for Lab 9 due April 10 – Last day to turn in Lab 7 for any credit, last day to turn in Lab 8 for extra credit presentations, Milestone build 1 for Lab 9 due

3 Week’s Topics Created code to look in a row of a Tic Tac Toe board to see if there was exactly one X, one O and one blank. Created code to look in a row of a Tic Tac Toe board to see if there was exactly one X, one O and one blank. Repetition using a for-loop Repetition using a for-loop

4 Week’s Topics For-loop syntax For-loop syntax for(declaration/initialization; ; ) { for(declaration/initialization; boolean expression; increment) { //loop body //loop body} Declaration/initialization of the loop counter variable (usually) Boolean expression that tells when the loop should stop Increment the loop counter variable (usually)

5 Week’s Topics The initialization/declaration happens first. The initialization/declaration happens first. Then, the boolean expression is evaluated. If true, the loop body is executed, and then the increment is executed. (Now loop back to the beginning of this bullet). Then, the boolean expression is evaluated. If true, the loop body is executed, and then the increment is executed. (Now loop back to the beginning of this bullet). If false, the loop ends. If false, the loop ends.

6 Week’s Topics If-statements If-statements Way to select code to execute on the result of a boolean expression. Way to select code to execute on the result of a boolean expression. Can be evaluation of an expression that returns a boolean or a method that returns a boolean value. Can be evaluation of an expression that returns a boolean or a method that returns a boolean value.

7 Week’s Topics Syntax: Syntax: if(boolean expression) { //code to be executed if b.e. //code to be executed if b.e. //is true //is true}

8 Week’s Topics Two choices – if/else Two choices – if/else Syntax: Syntax: if(boolean expression) { //code to be executed if b.e. is true //code to be executed if b.e. is true} else { //code to be executed if b.e.is false //code to be executed if b.e.is false}

9 Week’s Topics Building the game memory Building the game memory Take a moment to think about what are the important aspects/tasks we will need to build to create this game. Take a moment to think about what are the important aspects/tasks we will need to build to create this game.

10 List of Tasks for Memory Cells with mouse click listeners Cells with mouse click listeners Hash map Hash map Something to put into the hash map (images) Something to put into the hash map (images) 2 hash maps, why? 2 hash maps, why? Cell and symbol Cell and symbol Symbol and location Symbol and location Random number generator to assign the location of the cards (shuffling) Random number generator to assign the location of the cards (shuffling) Switch turns Switch turns

11 List of Tasks for Memory Counter for knowing turns Counter for knowing turns Keep randomizer from putting 2 cards in the same place Keep randomizer from putting 2 cards in the same place Graphics Graphics Row and columns need to be even numbered, even number of cards Row and columns need to be even numbered, even number of cards What about jokers?/ wild cards? What about jokers?/ wild cards? Odd number of pairs so one person can win (maybe) Odd number of pairs so one person can win (maybe)

12 List of Tasks for Memory When 2 images are visible, check to see if they are same, and flip over if not same (on a delay) When 2 images are visible, check to see if they are same, and flip over if not same (on a delay) How turns are taken How turns are taken If cards are same, remove them form the board If cards are same, remove them form the board Check to see if board is clear, determine who won Check to see if board is clear, determine who won Number of players Number of players

13 What do we do first? Get a window appearing on the screen that has a place for the cards (no cards yet) and a menu for selecting to start the game (no listener yet). Get a window appearing on the screen that has a place for the cards (no cards yet) and a menu for selecting to start the game (no listener yet). This code was checked into the repository. This code was checked into the repository.


Download ppt "CSE 115 Week 12 March 31 – April 4, 2008. Announcements March 31 – Exam 8 March 31 – Exam 8 April 6 – Last day to turn in Lab 7 for a max grade of 100%,"

Similar presentations


Ads by Google