200 likes | 300 Views
As you come in…. Sign in (in back) and pick up Badge Name Card – write your first name LARGELY on back Any questions? (of any kind) Put on index cards, drop in box (up front) Log in: Launch/Start Alice Open a web browser, log in at http://piazza.com Check your email for invitation.
E N D
As you come in… • Sign in (in back) and pick up • Badge • Name Card – write your first name LARGELY on back • Any questions? (of any kind) • Put on index cards, drop in box (up front) • Log in: • Launch/Start Alice • Open a web browser, log in at http://piazza.com • Check your email for invitation
Question! • How do you remember all of this?!?!? • I am used to taking notes… • VERY GOOD QUESTION! • It’s because of the computer… • The ability to interact with it to “find out what’s true”
How do you remember what to say about specific topics (questions, slides, etc.) • We’ve got copious notes for you • On each slide • We have videos • Demoing as we would do in class • Watch them yourself, or have students watch them
Agenda (modify?) • Dates for Summer PD • UCSD Class Month of July (observe once, optional attend) • Basics of Programming: Flow of Control • How programs are different than essays • Sequential, Parallel, Repeated, Conditional • Nested Loops • One loop inside another • Nested Ifs • One if inside another (in “true” or “false” part)
Vocabulary Review • Object • Instruction / Tile • Method • Parameter • Loop (aka Counted Loop) -- repetition • If statement -- conditional
Nested Loop: Eat At Joe’s (lecture example) • Let’s look at it • Show how to make something invisible • Build the code together
Eat At Joes, Nested Loop • Opacity 1 is visible • Opacity 0 is invisible
Nested Loops: Bunny Square Dance • We want to direct the bunny to hop in a square pattern. The “length” of each side of his square should be 5 hops. • Let’s watch • Break down the problem: • Create “one side” of square • Create turn • Repeat that whole thing…
Nested Loops: Bunny Square Dance • We want to direct the bunny to hop in a square pattern. The “length” of each side of his square should be 5 hops. • Let’s watch • Here’s the structure of our code, what numbers would you put in for each missing number?
Review: Ifs – Conditional Execution • With one if statement, we could do • Either “then block” or the “else block” but not both Then block Else block
More Complex Conditional Execution(e.g. more than one “test”) • b
More Complex Conditional Execution(e.g. more than one “test”) • b
More Complex Conditional Execution(e.g. more than one “test”) • b
Let’s make a game! • Player can click on a ball • The bunny will say something different depending on the ball chosen. • We’ll build up our solution a bit at a time • Get red and blue working (with one if statement) • Get green working(nested if statement) • Online Textbook Example • Section 9.2 BUT WAIT!
EVENTS! • Simple way to take user control • Many ways, we’ll stick to “click on object” • NEW CONCEPT: Parameter • A value you can send to a method that controls how it works • Wait! We know this! • We’ll create our own parameter to the my first method • If this is confusing, don’t worry, we’ll explore more…
What does this code do? • Assume that you have an event so that when you click on an igloo it calls a my first method and sends the igloo as a parameter • Next we’ll show youmy first methodand askyou what it does
Feedback Paraphrase Justify What does this code do?When blue, red or green… World.my first method
How many of the following are true? • When the igloo is blue, says Ice Cold! • When the igloo is red, says Hot! • When the igloo is blue, says Ice Cold! AND then says Try again! • When the igloo is green, nothing happens
blue, says Ice Cold! red, says Hot! blue, says Ice Cold! AND then says Try again! green, nothing happens Feedback Paraphrase Justify • 1 B) 2 C)3 D) 4 E)