As you come in… DOWNLOADS FOR TODAY: Alice Project: Wanda Dann and Don Slater, CMU What do you...

14
As you come in… DOWNLOADS FOR TODAY: http://ce21sandiego.org/2013 Alice Project: Wanda Dann and Don Slater, CMU What do you still need (Alice content/understanding)? (I’ll answer next week…) Index cards As many as you want Counted loops, nested loops, while loops, if statements, nested if statements, functions, expressions, compound boolean expressions, methods parameters

Transcript of As you come in… DOWNLOADS FOR TODAY: Alice Project: Wanda Dann and Don Slater, CMU What do you...

Page 1: As you come in… DOWNLOADS FOR TODAY:  Alice Project: Wanda Dann and Don Slater, CMU What do you still need (Alice content/understanding)?

As you come in…

DOWNLOADS FOR TODAY: http://ce21sandiego.org/2013

Alice Project: Wanda Dann and Don Slater, CMU What do you still need (Alice

content/understanding)? (I’ll answer next week…) Index cards As many as you want Counted loops, nested loops, while loops, if

statements, nested if statements, functions, expressions, compound boolean expressions, methods parameters

Page 2: As you come in… DOWNLOADS FOR TODAY:  Alice Project: Wanda Dann and Don Slater, CMU What do you still need (Alice content/understanding)?

RSVP: Snacks next week

Wrap up at 5:30 “Snacks and beverages” on the patio

5:30-6:30

Page 3: As you come in… DOWNLOADS FOR TODAY:  Alice Project: Wanda Dann and Don Slater, CMU What do you still need (Alice content/understanding)?

Other administrative stuff?

Page 4: As you come in… DOWNLOADS FOR TODAY:  Alice Project: Wanda Dann and Don Slater, CMU What do you still need (Alice content/understanding)?

Today’s plan

Methods and Parameters (Probably next time) Lists

Page 5: As you come in… DOWNLOADS FOR TODAY:  Alice Project: Wanda Dann and Don Slater, CMU What do you still need (Alice content/understanding)?

Last Time…

Module 2: Make Methods Escape FreakOut Apologize

Did we – add a parameter to our methods? How many times should promGuy spin in

his freakout? What should georgeBeetle say as an

apology? What should promGuy say in his freakout?

Page 6: As you come in… DOWNLOADS FOR TODAY:  Alice Project: Wanda Dann and Don Slater, CMU What do you still need (Alice content/understanding)?

One should use methods in programs primarily…

A. For the computerB. For the person writing the programC. For people reading a programD. More than one of the above

And WHY is it important?

Page 7: As you come in… DOWNLOADS FOR TODAY:  Alice Project: Wanda Dann and Don Slater, CMU What do you still need (Alice content/understanding)?

How to “make” methods

Think of ways in which your planned animation has natural “parts” Give each of the parts a name Put the code that makes that “part” happen

in a method with that name Call that method from my first method, in

the right order.

Page 8: As you come in… DOWNLOADS FOR TODAY:  Alice Project: Wanda Dann and Don Slater, CMU What do you still need (Alice content/understanding)?

Example: Going to a movie…

Walk up to ticket window Walking in group

Buy tickets Interact with ticket seller (talking, hand over

money, get tickets) Enter theater

Walk through doors, hand tickets to worker, walk into lobby

Buy snacks… Take seats… Make snarky critiques… …

Page 9: As you come in… DOWNLOADS FOR TODAY:  Alice Project: Wanda Dann and Don Slater, CMU What do you still need (Alice content/understanding)?

Exercise! Choices…

Choice 1: Set up the world yourself, or start with one we set up Do you want practice in setting up world? Focus on methods/parameters

Which exercise: Helicopter Flight Beetle Band

Page 10: As you come in… DOWNLOADS FOR TODAY:  Alice Project: Wanda Dann and Don Slater, CMU What do you still need (Alice content/understanding)?

Helicopter Flight [1]

Create a world with a helicopter (Vehicles gallery), airport (Buildings), and a control tower (Buildings).

Part A: Create a circleTower method that makes the helicopter fly

toward the control tower and then around it. In my first method call the circleTower method twice, and then make the helicopter land on the landing strip.

Part B: Modify circleTower to take a parameter indicating how many

times it should “go around” the tower. Change the method call in myFirstMethod to only call the method once, but use a parameter to make it circle 2 time (then try 4 times).

Add another object to the world (maybe a bird or flying dinosaur). Modify the circleTower method to take a second parameter which controls which object should circle the tower.

[1] From Learning to Program with Alice textbook, do not use with students

Page 11: As you come in… DOWNLOADS FOR TODAY:  Alice Project: Wanda Dann and Don Slater, CMU What do you still need (Alice content/understanding)?

Beetle Band [1]

Create a world with a stage, and 4 beetles (Animals, Bugs) ringoBeetle, paulBeetle, Lennonbeetle, and georgeBeetle on it. Give them each an instrument (you can pick). Set the instrument’s “vehicle” to their beetle (whoever has that instrument).

Create a method called paulSolo that makes paulBeetle do a “solo” but moving up and down while he spins around 1 revolution. Call this method from myFirstMethod.

Modify the method to be called solo – and control which beetle dances by passing it as a parameter. In myFirstMethod, call solo so that each beetle does his solo in order from left to right.

Modify the solo method to be more flexible by sending a parameter which is the number of spins a beetle should do when soloing

[1] From Learning to Program with Alice textbook, do not use with students

Page 12: As you come in… DOWNLOADS FOR TODAY:  Alice Project: Wanda Dann and Don Slater, CMU What do you still need (Alice content/understanding)?

Below: what happens after the last instruction in the mystery method is finished executing?

A. The program starts the World.my first methodB. The program goes back to my first method

and calls method XXXXXC. The program goes back to my first method

and calls method YYYYYD. We can’t tell, we need to know more about the

storyboard to be able to say

Page 13: As you come in… DOWNLOADS FOR TODAY:  Alice Project: Wanda Dann and Don Slater, CMU What do you still need (Alice content/understanding)?

If we write a method called drive, which would not make sense as a parameter to control how drive occurs?

A. DestinationB. How fastC. Which carD. Car color

Page 14: As you come in… DOWNLOADS FOR TODAY:  Alice Project: Wanda Dann and Don Slater, CMU What do you still need (Alice content/understanding)?

Which of the following is the best explanation of what makes a good parameter

A. It’s something that supports common variation in how the method is done

B. It’s got a meaningful nameC. It can be either an Object or a numberD. It’s helps manage complexity in large

programs