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%,

Slides:



Advertisements
Similar presentations
Decision Structures - If / Else If / Else. Decisions Often we need to make decisions based on information that we receive. Often we need to make decisions.
Advertisements

RAPTOR Syntax and Semantics By Lt Col Schorsch
Conditionals Lab Dan Maselko. Overview  Gain familiarity with working with conditionals  Become familiar with using the modulus operator  Understand.
Integer Tic Tac Toe Let’s Begin Rules: 1.Erase all x’s and o’s from the previous game before you begin. 2.Decide which player will be x’s and which will.
1 CSE1301 Computer Programming: Lecture 23 Algorithm Design (Part 1)
July 13 th.  If/ Else if / Else  Variable Scope  Nested if/else's  Switch statements  Conditional Operator.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
Executes a statement or statements for a number of times – iteration. Syntax for(initialize; test; increment) { // statements to be executed } Initial.
CSE 115 Week 13 April , Announcements April 7 – Exam 9 April 7 – Exam 9 April 10 – Last day to turn in Lab 7 for any credit, last day to turn.
CSE 115 Week 11 March , Announcements March 26 – Exam 7 March 26 – Exam 7 March 28 – Resign Deadline March 28 – Resign Deadline Lab 7 turned.
COMP 14 Introduction to Programming Mr. Joshua Stough February 16, 2005 Monday/Wednesday 11:00-12:15 Peabody Hall 218.
Week 10 Recap CSE 115 Spring For-each loop When we have a collection and want to do something to all elements of that collection we use the for-each.
Building Memory… Notes from class on 4/4/07. The Game First understand what we are trying to build. Then, create a list of requirements/functionality.
CSE 115 Week 14 April , Announcements April 14 – Exam 10 April 14 – Exam 10 April 18 – Last day to turn in Lab 8 for any credit April 18.
If Statements Sections 1.25, Control Structures o All code thus far executes every line of code sequentially o We want to be able to repeat,
Building Memory… Day 7 – April 18, Mouse Listener Attached listeners to each card (but the back image only) When click event is generated, simply.
CSE1301 Computer Programming: Lecture 27 Game Programming: Bingo.
CSE 113 Week 5 February , Announcements  Module 2 due 2/15  Exam 3 is on 2/15  Module 3 due 2/22  Exam 4 is on 2/25  Module 4 due 2/29.
Week 11 Recap CSE 115 Spring Want to write a programming language? You’ll need three things: You’ll need three things: –Sequencing –Selection Polymorphism.
Tutorial 4 Decision Making with Control Structures and Statements Section A - Decision Making JavaScript Tutorial 4 -Decision Making with Control.
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
Chapter 12: How Long Can This Go On?
Jaeki Song ISQS6337 JAVA Lecture 04 Control Structure - Selection, and Repetition -
ㅎㅎ logical operator if if else switch while do while for Third step for Learning C++ Programming Repetition Control Structures.
1 Conditionals In many cases we want our program to make a decision about whether a piece of code should be executed or not, based on the truth of a condition.
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 ‏ Control Structures.
1 CSCI N201 Programming Concepts and Database 9 – Loops Lingma Acheson Department of Computer and Information Science, IUPUI.
1 Chap 4. Data Should know Declare & Initialize variables Declare constants Assignment Operators Increment and Decrement Operators Precedence of Operators.
Visual Basic Games: Week 4 Recap Parallel structures Initialization Prepare for Memory Scoring Shuffling Homework: when ready, move on to next game/chapter.
Course A201: Introduction to Programming 09/16/2010.
1 CS 177 Week 12 Recitation Slides Running Time and Performance.
Introduction to Matlab Module #4 Page 1 Introduction to Matlab Module #4 – Programming Topics 1.Programming Basics (fprintf, standard input) 2.Relational.
February ,  2/16: Exam 1 Makeup Papers Available  2/20: Exam 2 Review Sheet Available in Lecture  2/27: Lab 2 due by 11:59:59pm  3/2:
Lecture 2 Conditional Statement. chcslonline.org Conditional Statements in PHP Conditional Statements are used for decision making. Different actions.
Chapter 15 JavaScript: Part III The Web Warrior Guide to Web Design Technologies.
Quiz 3 is due Friday September 18 th Lab 6 is going to be lab practical hursSept_10/exampleLabFinal/
Loops Robin Burke IT 130. Outline Announcement: Homework #6 Conditionals (review) Iteration while loop while with counter for loops.
Lec 21 More Fun with Arrays: For Loops. Agenda Some backfill for Lab 20: – Using an array in an applet or class – array instance variables – using Math.random()
1 Printing in Python Every program needs to do some output This is usually to the screen (shell window) Later we’ll see graphics windows and external files.
Random Numbers Random numbers are extremely useful: especially for games, and also for calculating experimental probabilities. Formula for generating random.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 13 How Long Can This Go On?
Application development with Java Lecture 6 Rina Zviel-Girshin.
Midterm Exam Topics (Prof. Chang's section) CMSC 201.
The If Statement There are no switch statements in Python. You need to use just if statements. There are no switch statements in Python. You need to use.
CMSC 150 LOOPS CS 150: Fri 20 Jan Representing DNA AGTCCAGTGTCAA.
Beginning C For Engineers Fall 2005 Lecture 3: While loops, For loops, Nested loops, and Multiple Selection Section 2 – 9/14/05 Section 4 – 9/15/05 Bettina.
Catie Welsh February 9,  Friday - No Lab! ◦ Bring questions on Project 2  Lab 3 due on Friday 2.
IST 210: PHP LOGIC IST 210: Organization of Data IST210 1.
Variables, operators, canvas, and multimedia Dr. Reyes.
Structured Programming Structured Programming is writing a program in terms of only 3 basic control structures: sequence selection repetition We have already.
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 2: Control Structures (Selection & Repetition)
Chapter 7 Control Structures. Java has very flexible three looping mechanisms. You can use one of the following three loops:  while Loop  do...while.
Conditional Statements A conditional statement lets us choose which statement will be executed next Conditional statements give us the power to make basic.
Selection (if-then-else) Programming Has 3 Types of Control: Sequential (normal): Control of Execution Proceeds One after the Other Selection (if-then-else):
CE En 270 Brigham Young University Norm Jones
Follow up from lab See Magic8Ball.java Issues that you ran into.
ECS10 10/10
3rd prep. – 2nd Term MOE Book Questions.
LRobot Game.
Selection (if-then-else)
Collections & Definite Loops
Chapter (3) - Looping Questions.
Computer Science Core Concepts
Seating “chart” Front Back 4 rows 5 rows 5 rows 4 rows 2 rows 2 rows
February , 2009 CSE 113 B.
Tic Tac Toe application
Seating “chart” Front - Screen rows Back DOOR.
Instructor: Craig Duckett
Building Memory… Day 3 – April 9, 2007.
PROGRAM FLOWCHART Iteration Statements.
Presentation transcript:

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%, 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

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

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)

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.

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.

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}

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}

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.

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

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)

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

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.