CS320n – Elements of Visual Programming Lists Mike Scott (Slides 9-1) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for slide ideas.

Slides:



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

CS320n –Visual Programming Class-level Methods and Inheritance – Part 1 Mike Scott (Slides 4-3-1) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger.
Class-level Methods and Inheritance MMP 220 Multimedia Programming This adapted material was prepared for students in MMP220 as as part of a curriculum.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
CS320n –Visual Programming Random Numbers and Random Motion (Slides 6-3) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for slide ideas.
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.
CS320n –Visual Programming Functions Mike Scott (Slides 6-1) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for slide ideas.
Classes, Objects, and World-level Methods Alice. Programming in Alice© 2006 Dr. Tim Margush2 Class / Object Class A template describing the characteristics.
Alice: A Free 3D Animation World for Teaching Programming Barbara Ericson Georgia Institute of Technology Oct 2005.
Methods Tutorial: Part One By Deborah Nelson Duke University Under the direction of Professor Susan Rodger June 9, 2008.
Shorter of two objects and changing color Functions, events and setting the color Susan Rodger, Duke University June 2008.
Checking for Collisions Ellen Yuan Under the direction of Professor Susan Rodger at Duke University June 2014.
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
Shorter of two objects and changing color V2 Functions, events and setting the color in sequence and randomly This is a modification of the Changing Color.
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.
Introduction to Arrays. definitions and things to consider… This presentation is designed to give a simple demonstration of array and object visualizations.
Nonvisual Arrays and Recursion by Chris Brown under Prof. Susan Rodger Duke University June 2012.
Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.
The Very Basics of Alice: A Simple Overview 6 th & 7 th Grade Tech Apps.
Methods Tutorial: Part Two By Deborah Nelson Duke University Professor Susan Rodger June 16, 2008.
Now that the kangaroo and the turtle have raced, let's make a method for the kangaroo to hop back to the turtle and challenge him to a race again. Click.
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.
What we will do today Learn about functions in Alice.
Making a Timer in Alice By Jenna Hayes under the direction of Professor Susan Rodger Duke University July
CS320n –Visual Programming Introduction to Recursion (Slides 8-1) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for slide ideas.
Introduction to ArcGIS for Environmental Scientists Module 3 – GIS Analysis Model Builder.
Alice Workshop November 2009 By: Kim Glavan New Lenox School Dist #122.
CS320n – Elements of Visual Programming Sending Parameters to Event Handler Methods (Slides 5-2) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for.
1 Quiz Template: Using the ‘ask user’ functions By Deborah Nelson Duke University Under the direction of Professor Susan Rodger July 2009.
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.
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.
Lists Alice. Collections In some animations, several objects must perform the same actions Example: A marching band, where the band members are performing.
CS320n –Visual Programming Definite / Counted Loops (Slides 7-1) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for slide ideas.
Wanda Dann Don Slater Classes and Objects Copyright 2012 Wanda Dann, Don Slater All rights reserved.
BDE tutorial By Deborah Nelson Duke University Under the direction of Professor Susan Rodger July 13, 2008.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
CompSci 4 Chap 6 Sec 2 Sep 30, 2010 Prof. Susan Rodger “All your troubles are due to those ‘ifs’,” declared the Wizard. If you were not a Flutterbudget.
CompSci 4 Chap 9 Sec 1 October 28, 2010 Prof. Susan Rodger.
CompSci 4 Chap 4 Sec 3 Sept 23, 2010 Prof. Susan Rodger.
Using Placeholders to Simplify your Methods: Learning Methods, Part 2 By Deborah Nelson Duke University Professor Susan Rodger June 16, 2008.
CS320n –Visual Programming Problem Solving Case Study (Slides 6-3) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for slide ideas.
Headshots in Alice Duke University Professor Susan H. Rodger Gaetjens Lezin July 2008.
CompSci 4 Chap 10 Nov 22, 2005 Prof. Susan Rodger Note: thanks to Wanda Dann and Steve Cooper for slide ideas.
CS320n –Visual Programming Execution Control with If / Else and Boolean Functions (Slides 6-2-1) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for.
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),
CS320n – Elements of Visual Programming List Search Mike Scott (Slides 9-2) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for slide ideas.
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.
Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.
Lists and Iteration in Alice
How to automatise the grid production - using model builder in ArcGIS
Learning Java with Alice 3.0 Game Design Kathy Bierscheid
CS320n –Visual Programming
Lists Alice.
CS320n –Visual Programming
Lists Alice.
Arrays
Lists Alice.
Lists Alice.
Classes and Objects Wanda Dann Don Slater
Tutorial for Arrays and 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.
Class-level Methods and Inheritance
Presentation transcript:

CS320n – Elements of Visual Programming Lists Mike Scott (Slides 9-1) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for slide ideas.

Visual ProgrammingAnimation Programs2 Collections In some animations, several objects must perform the same actions – Example: Cars in lanes from Frogger In such situations, it is convenient to collect all the objects into a group (a collection) Major benefit of Lists is we can write code for each object in the list –rather than separate code for each object

Visual ProgrammingAnimation Programs3 List One way to organize objects into a collection is to use a list. – We use lists to help us organize things. For example, assignments list shopping list inbox In programming, a list is known as a data structure. –an object that is used to group other objects together

Visual ProgrammingAnimation Programs4 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.

Visual ProgrammingAnimation Programs5 Example Create a List of chickens add 5 chicken objects to the world

Visual ProgrammingAnimation Programs6 Creating a list: Step 1 Create the initial world and add five chicken 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?)

Visual ProgrammingAnimation Programs7 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 chickens, one at a time

Visual ProgrammingAnimation Programs8 Resulting List No change in the scene We have simply added them to a list variable

Visual ProgrammingAnimation Programs9 Programming with a list Now that a list has been created, how do we use the list in a program? One of the most powerful operations with a list is to repeatedly perform some action with each item in the list. This is called iteration or "iterating through a list."

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

Visual ProgrammingAnimation Programs11 Example/Demo: Iteration in Order Have each chicken say hello Have each chicken kicks its legs

Visual ProgrammingAnimation Programs12 The “Object’s part named X” function One problem when passing Objects as parameters is how do I affect a sub part? If the parameter type is simply Object subparts are unknown Same problem with elements of a list Use the Object’s part named X function

Visual ProgrammingAnimation Programs13 Part named function Get "in order" operation for list Drop in a Chicken object Pick functions for Chicken Object and drag the part named function to replace the Chicken object

Visual ProgrammingAnimation Programs14 Part Named Function Select which part Pick other and type in name of sub part

Visual ProgrammingAnimation Programs15 Part Named function Replace Chicken object with item_from_chickens Final version

Visual ProgrammingAnimation Programs16 Example / Demo: Iteration Together Change the previous animation so that the chickens move their legs together