Lists Alice. Collections In some animations, several objects must perform the same actions Example: A marching band, where the band members are performing.

Slides:



Advertisements
Similar presentations
Visual Lists By Chris Brown under Prof. Susan Rodger Duke University July 2012.
Advertisements

Class-level Methods and Inheritance Part 1 Alice.
Class-level Methods and Inheritance MMP 220 Multimedia Programming This adapted material was prepared for students in MMP220 as as part of a curriculum.
Parameters and World-level methods Alice. Our Dragon world The dragon must to take off and fly, to carry the princess.
Monkey See, Monkey Do. Important Turn on Java-like syntax option in Alice, if is not on already.
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
Fall 2009ACS-1805 Ron McFadyen1 Functions A function is a collection of statement, similar to a method, but a function is defined to return a value to.
Fall 2007ACS-1805 Ron McFadyen1 Functions and if-else A function is a collection of statement, similar to a method, but a function is defined to return.
Fall 2007ACS-1805 Ron McFadyen1 Ch 9 Lists In some animations, several objects must perform the same actions Example: A marching band, where the band members.
Methods Tutorial: Part One By Deborah Nelson Duke University Under the direction of Professor Susan Rodger June 9, 2008.
METHODS!.  A method is a sequence of instructions or behaviors that will be carried out when requested.  You can use them to create new methods so that.
Functions and Conditionals in Alice 1 Stephen Cooper Wanda Dann Barb Ericson September 2009.
Today’s Agenda 1.Collect Pre-Lab 4 2.Alice Programming Assignment Storyboards 3.Classes 4.Objects 5.Methods 6.Assign pair programming teams and meet upstairs.
Tutorial for Arrays and Lists By Ruthie Tucker. Description This presentation will cover the basics of using Arrays and Lists in an Alice world This presentation.
by Chris Brown under Prof. Susan Rodger Duke University June 2012
Making a Timer in Alice.
Skater World: Part Two By Deborah Nelson Duke University Under the direction of Professor Susan Rodger June
Changing Camera Views! Part 2: Simple Scene Change & Lighting Fixes By Bella Onwumbiko under the direction of Professor Susan Rodger Duke University July.
3–D Helium Molecule Tutorial Alice Project Duke University Professor Susan H. Rodger Gaetjens Lezin June 2008.
The Very Basics of Alice: A Simple Overview 6 th & 7 th Grade Tech Apps.
Changing Color, Using Text Objects, and Random Selection in Alice By Jenna Hayes Under the direction of Professor Susan Rodger Duke University, July 2008.
Teaching a character to walk in more than one world: Parameters and Inheritance. By Lana Dyck under the direction of Professor Susan Rodger Duke University.
By Deborah Nelson Duke University Professor Susan Rodger July 13, 2008.
Animating Objects in Groups: Using Arrays and Lists By Ruthie Tucker under the direction of Professor Susan Rodger Summer 2008.
Lists Tutorial By Deborah Nelson Duke University Professor Susan Rodger July 13, 2008.
Writing Our Own Functions Alice. Functionality A function receives value(s), performs some computation on the value(s), and returns (sends back) a value.
Functions Alice.
Making a Timer in Alice By Jenna Hayes under the direction of Professor Susan Rodger Duke University July
Piñata Game: Keeping Score in Alice By Maggie Bashford Professor Susan Rodger Duke University July
Skater World: Part Two By Deborah Nelson Duke University Under the direction of Professor Susan Rodger June 1,
CS320n – Elements of Visual Programming Lists Mike Scott (Slides 9-1) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for slide ideas.
Alice Workshop November 2009 By: Kim Glavan New Lenox School Dist #122.
Bunny Eat Broccoli Repetition – Simple loops and Conditional loops Susan Rodger Duke University July 2011.
Variables and Functions Chapter Variables Named storage location in computer’s memory Programs may need to store data when running Types of data.
Alice 3.0 A Guided Tour Mike R-D YRDSB. Agenda General Walkthrough of Alice 3.0 Loops, Variables, Threads Methods / Properties Arrays Misc.
Variables and Functions Alice. Naming is Important If you get a new pet one of the first things you do is name it Gives you a way to refer to the new.
Functions Sec 8-11 Web Design. Objectives The Student will: Understand what a function is Know the difference between a method and a function Be able.
Today’s Agenda 1.Collect Pre-Lab 3 2.Alice Programming Assignment 3.Built-in Functions 4.Expressions 5.Control Structure 6.Assign pair programming teams.
Tutorial for Arrays and Lists. Description This presentation will cover the basics of using Arrays and Lists in an Alice world It uses a set of chickens.
Questions Alice. Functionality A question receives value(s), performs some computation on the value(s), and returns (sends back) a value.
Class-level Methods and Inheritance Alice. Class-level Methods Some actions are naturally associated with a specific class of objects. Examples A person.
Lists Alice. Collections In some animations, several objects must perform the same actions Example: A marching band, where the band members are performing.
Lists Alice. Collections In some animations, several objects must perform the same actions Example: A marching band, where the band members are performing.
CompSci 4 Chap 9 Sec 1 October 28, 2010 Prof. Susan Rodger.
CompSci 4 Chap 4 Sec 3 Sept 23, 2010 Prof. Susan Rodger.
Personal Planning System The Adding a Program to the Library Enterprise Edition.
Class-level Methods and Inheritance Alice. Class-level Methods Some actions are naturally associated with a specific class of objects. Examples A person.
Variables and Inheritance Part 1 Alice. Review: Properties A class defines properties for its own kind of object. When an object is created (instantiated),
1 Quiz Show Programming Terms. 2 Alice - 3D Virtual Programming Vocabulary Quiz Board Chapter 1 Chapter 2a Chapter 2b Chapter 3 Chapter 4 $100 $200 $300.
Xin Liu Dec 1, Sound Open lab6.a2w Import horseneigh.wav as a property Add the method “play sound” to horse.neigh Exercise Create a class-level.
Lists and Iteration in Alice
Creating your Function
Putting Objects in Motion
Bunny Eat Broccoli Repetition – Simple loops and Conditional loops
Changing Color, Using Text Objects, and Random Selection in Alice
Repeating Actions.
Simple Control Structures
Making Objects Move in Unison: Using Lists
Making Objects Move in Unison: Using Lists
Lists Alice.
Lists Alice.
Making Objects Move in Unison: Using Lists
Using Functions
Lists Alice.
An Introduction to Programming Using Alice 2.2, Second Edition
Lists Alice.
Tutorial for Arrays and Lists
Making Objects Move in Unison: Using Lists
Ch 9 Lists In some animations, several objects must perform the same actions Example: A marching band, where the band members are performing the same.
Presentation transcript:

Lists Alice

Collections In some animations, several objects must perform the same actions Example: A marching band, where the band members are performing the same marching steps. In such situations, it is convenient to collect all the objects into a group (a collection)

List One way to organize objects into a collection is to use a list. In our daily lives, we use lists to help us organize things. For example, assignments list shopping list In programming, a list is known as a data structure.

Types of Lists In Alice, a list can be a list of numbers or a list of objects, colors, or other type …. In this session, we will use an example of a list of objects.

Example The famous Rockettes ® are preparing for their winter holiday show. You have been hired to create an animation for the holiday show that will be used on a web site where people can purchase tickets for the show.

Creating a list: Step 1 Create the initial world and add five rockette objects to the world. Then, create a new world- level variable in the properties panel. (Why should it be world-level rather than class-level?)

Creating a list: Step 2 In the popup dialog box, type in a name select Object type check “make a List” box click new item button 5 times to select each of the 5 rockettes, one at a time

Programming with a list Now that a list has been created, how do we use the list in a program? One of the most useful operations with a list is to repeatedly perform some action with each item in the list. We call this iteration or "iterating through a list."

Iterating through a list Iteration can be done in two ways: in order (one at a time) all together (simultaneously)

Example: Iteration in Order A typical chorus line dance involves each dancer (one after the other) kicking up one leg. Possible storyboard: For all dancers in order item_from_dancers kickUpRightLeg kickUpRightLeg Parameter: whichRockette Do in order Do together whichRockette right thigh turn back whichRockette right calf turn forward whichRockette right calf turn back

Steps to create the first turn instruction in kickUpRightLeg 1.Create an instruction to turn one of the rockettes backward.25 revolutions 2.Then, drag in the part named function for the rockette and drop it on top of the rockette tile. 3.Click to the right of part name and enter the exact name of the part- Alice is case sensitive: type it correctly! hips.rightThigh 4.Now drag the whichRockette parameter tile down to drop it on top of the rockette.

For All in Order The For all in order statement executes the action for all list items in order.. For All in Order tile is dragged into the editor The expression World.dancers is selected as the name of the list Inside the the For All in Order, call the World.kickUpRightLeg with which Rockette = item_from_dancers