Meeting3 Slides - CE21 San Diego

advertisement
As you come in…

Sign in (in back) and pick up
 Badge
 Name

Any questions? (of any kind)
 Put

Card – write your first name LARGELY on back
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?
Outer Loop count
Inner Loop count
Turn parameter
A
4
5
.25
B
4
5
1
C
5
4
.25
D
5
4
1
Goal: Hop in a square, 5 hops on each side
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
 If
create our own parameter to the my first method
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 you
my first method and ask
you what it does
What does this code do?
When blue, red or green…
World.my first method
Feedback
Paraphrase
Justify
How many of the following are true?
1.
2.
3.
4.
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
1.
2.
3.
4.
blue, says Ice Cold!
red, says Hot!
blue, says Ice Cold! AND then says Try again!
green, nothing happens
A) 1
B) 2
C)3
D) 4
Feedback
Paraphrase
Justify
E)
Download