Functions and Expressions

Slides:



Advertisements
Similar presentations
Princess & Dragon – Version 2 By Michael Hoyle under the direction of Professor Susan Rodger Duke University July 2012 Part 2: Using Methods.
Advertisements

How Tall Are You? Introducing Functions By Jenna Hayes under the direction of Professor Susan Rodger Duke University July 2008 Updates made June 2014 by.
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
Programming in Alice Chapter 2 Part 2. Events Editor Identifies what method is executed (run) when the “Play” button is hit 2.
Calvin and Hobbes Teach Properties and Functions Created by Daniel MacDonald under the direction of Professor Susan Rodger Duke University June 2013.
Click on the Insert tab at the top of the page.. The insert picture box will come up with your pictures that are on your computer. Choose the picture.
by Chris Brown under Prof. Susan Rodger Duke University June 2012
Programming Alice Alice is named in honor of Lewis Carroll’s Alice in Wonderland.
Solidworks Lesson 6 - Assembly Drawings
Skater World: Part Two By Deborah Nelson Duke University Under the direction of Professor Susan Rodger June
3–D Helium Molecule Tutorial Alice Project Duke University Professor Susan H. Rodger Gaetjens Lezin June 2008.
Microsoft Word Tables ITSW 1401, Intro to Word Processing Instructor: Glenda H. Easter.
Alice: A Visual Introduction to Programming Chapter 1 Part 2.
Four Fundamental Pieces Instruction Control Structure Function Expression.
What we will do today Learn about functions in Alice.
Programming: Putting Together the Pieces Built-in Questions and Expressions Alice.
Simple Collision Detection By David Yan Under the direction of Professor Susan Rodger and Chari Distler Duke University, June 2015.
Tutorial on Kangaroo visiting his animal friends - parameters, events Susan Rodger Duke University June 2009.
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
Lesson 8C Animation and Events. Step 3: Animation Drag it into the method and have him say “let her go!” Click on the knight in the object tree and scroll.
Princess & Dragon Part 3: A Knight Comes Riding In—Cameras & Events By Elizabeth Liang under the direction of Professor Susan Rodger Duke University June.
How Tall Are You? Introducing Functions for Alice 3 By Jenna Hayes under the direction of Professor Susan Rodger Duke University July 2008 Updates made.
Tutorial on Bunny visiting his animal friends - parameters, events for Alice 3 Susan Rodger Duke University June 2009 Updated by Yossra Hamid on October.
Programming: Putting Together the Pieces Built-in Functions and Expressions Sec 8-5 Web Design.
Obj: to recognize built-in functions and expressions HW: Read Section 3.1 and do HW4 Edmodo article due Sunday at 8pm Edmodo feedback due 8pm 10/17 Do.
Programming: Putting Together the Pieces Built-in Functions and Expressions Sec 8-5 Web Design.
Functions Sec 51 Web Design.
Learn about functions in Alice
Professor Susan Rodger
Creating your Function
Obj: Introduction to Alice
Functions Sec 8-11 Web Design.
Tutorial on Kangaroo visiting his animal friends - parameters, events
Introduction to Alice Alice is named in honor of
Introduction to Alice Alice is named in honor of
Introduction to Programming
Michelle Venable-Foster Barb Ericson Jan 2007
Parameters and World-level methods
TEACHER CREATES KNOWLEDGE ACQUISITION
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
Making Objects Move in Unison: Using Lists
Pictures with reflection and blurred background (Basic)
Checking for Collisions: Using Functions in Alice
Introduction to Alice Alice is named in honor of
Using Functions in Alice
Pictures with reflection and blurred background (Basic)
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
Princess & Dragon Part 3: A Knight Comes Riding In—Cameras & Events
May 14, 2015 Ferris Wheel 3-D transition effect and pictures (Basic)
Pictures with reflection and blurred background (Basic)
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
How Tall Are You? Introducing Functions
Functions Alice.
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
Introduction to Alice Alice is named in honor of
Professor Susan Rodger
Pictures with reflection and blurred background (Basic)
Professor Susan Rodger
Click on “Slide Show” and “From Beginning
Functions.
Functions Alice.
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
Please Do Now / Dec. 2, 15 Log into computer Go to
Functions Alice.
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
Introduction to Alice Alice is named in honor of
Functions Alice.
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
Introduction to Alice Alice is named in honor of
Presentation transcript:

Functions and Expressions Note to Instructor: Slides may be used either in a traditional lecture format or with an Active Learning approach. If you are using an active learning approach, suggestions will appear in this "Notes" area on appropriate slides.

What will we learn today? We will learn today What are functions and expressions Functions in real life Built-in functions in Alice How to use functions and expressions

Functions and Expressions A statement you can use to ask a question about conditions/properties of an object or to compute a value Expression A math operation on numbers or other kinds of values

Functions in Real-Life We use functions to compute the hours in any given number of days (hours=days*24) The vending machine; you insert a currency into the machine and it dispenses items such as snacks, chocolates, water..etc to you automatically

Functions We use functions to get the information we need Q:How far away the camel is from the palm trees??

Built-in Functions Alice system provides a set of built-in functions for each object To view a list of built-in functions associate with an object in a world Select the object in the object tree View the functions in the details area

Built-in Functions The Built-in functions are divided into subcategories Proximity: how close the object is to other objects e.g. distance to Size: dimensions e.g. height, width and depth Spatial relation: orientation compared to other objects in the world e.g. to right of Point of view: position in the world Other: miscellaneous items

Expressions Alice Provides math operators for common math expressions Add(+), subtract(-), multiply (*) and divide(/) Obtaining math expression

Camel and distance to tree example We want the camel to move towards the palm tree and stops there Select the camel from the object tree Click on the methods tab Drag the ‘move’ method and place it into the program code editor (the large yellow pane)

Camel and distance to tree example Choose forward and 1m from the list shown Select the functions tab and drag the ‘distance to’ function under ‘proximity’ into the ‘1 meter’ box

Camel and distance to tree example Choose ‘plamTree’ from the list and the ‘entire plamTree’

Camel and distance to tree example Click on the arrow as shown below and choose math, camel distance to palmTree-1

Camel and distance to tree Simulation

Let’s work with Alice We will take the “raceCar” simulation and make the car Move to the palmTree Turn to face the lampPost Move forward half the distance to the lampPost