Functions.

Slides:



Advertisements
Similar presentations
Class-level Methods Chapter 6. Class-level Method Is specific to a class of objects We can give a class new abilities/methods Only involves this one class.
Advertisements

Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
Western Oregon University Oregon Department of Transportation Transportation Safety Division Driver Risk Prevention Curriculum Introduction to Backing.
Backing Turns Turn Head – Look to target area before turning wheel.
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.
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
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.
CS320n –Visual Programming Functions Mike Scott (Slides 6-1) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for slide ideas.
Tire Tracks & Impressions Sept 23, 2014 Discovery Science Video.
TIRE TRACKS. Track vs. Tread Tire Track: path left in the soil by the wheels of a vehicle Tire Tread: pattern of tread design on tire.
Don Slater Wanda Dann Motion and Rotation Copyright 2012 Wanda Dann, Don Slater All rights reserved.
Programming Alice Alice is named in honor of Lewis Carroll’s Alice in Wonderland.
Spherical Mirrors Alfano I: Year 4.
Halliday/Resnick/Walker Fundamentals of Physics
Sungwoo, Lim CAD centre Sungwoo, Lim CAD centre Supervisor: Dr. Alex H B Duffy Dr. B S Lee Dr. B S Lee Supervisor: Dr. Alex H B Duffy Dr. B S Lee Dr. B.
Four Fundamental Pieces Instruction Control Structure Function Expression.
By: Deana Van Brocklin.  A pictorial depth cue is an inaccurate perception our brain has.  In involves distance, shape & size.  I found 5 for each.
Writing Our Own Functions Alice. Functionality A function receives value(s), performs some computation on the value(s), and returns (sends back) a value.
What we will do today Learn about functions in Alice.
Functions Alice.
Motion Constraint Train Down the Track. Apply Angle Constraint to Workplanes Train is assembled at this point. Place a Workplane through the center of.
Mathematical Expressions, Conditional Statements, Control Structures
Programming: Putting Together the Pieces Built-in Questions and Expressions Alice.
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.
Questions Alice. Functionality A question receives value(s), performs some computation on the value(s), and returns (sends back) a value.
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.
Obstacle Detection. In the previous program the robot moves forward and then checks for something in the way. As we observed it only checks for things.
TRIGONOMETRY IDENTITIES. Simplify Verify the following identity!
Cutnell/Johnson Physics 8 th edition Classroom Response System Questions Chapter 2 Kinematics in One Dimension Interactive Lecture Questions.
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.
Calculating Rotations for Turns
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
Stringing your car to determine wheel alignment is decidedly old school, but it's also effective, efficient and cheap. Begin by placing your car in a level.
Teaching Characters to Walk: Learning Methods, Part 1
Robo-Math How Far? The Distance a Robot Travels in One Rotation of the Motor = The Circumference of the Wheel Circumference (of the Wheel) = Diameter (of.
Creating your Function
Introductory Presentation
Variables and Inheritance Part 2
Functions and Expressions
Introductory Presentation
Programming – Using a Range Finder
Functions Sec 8-11 Web Design.
Introductory Presentation
Introductory Presentation
Programming – Using a Range Finder
Chapter 1: Introduction to Alice and Objects
Beginner Programming Lesson
Chapter 11 Rolling, Torque, and Angular Momentum
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
Cubes Orthographic projections One and Two-point Perspective
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
Great! on in in front of under above next to behind between next.
Functions Alice.
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
3D Car Design Document Name: Period:.
Obstacle Detection.
Lego MINDSTORMS EV3.
Functions Alice.
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
Functions Alice.
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
Functions Alice.
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
Logic puzzle Lessons 39 and 40 worktime
Variables and Inheritance A More Complex Example
Presentation transcript:

Functions

Functions Methods that return a Value Number Boolean (True/False) Object Other (Sound, Video, etc.) Does not change the current state of the world Does not move / change objects

What Functions Do Check a current condition (run-time) Get information about objects Where they are Size Ask questions about the state of the world As it is now  With program running

Built In Functions Proximity Size Spatial Relationship Point of View Relation to other objects Size Spatial Relationship Point of View Proximity – where the object is Distance to Distance to right/left/above/below/behind Size: Height Width Depth Smaller Than/Larger Than Spatial Relationship To the left of To the right of above / below in front of / behind Point of View: Point of View Position

Where to Use – Calling the Function Anywhere that requires the type of information returned from the function Number Object Boolean Example: Bopper.move (how far) Bopper.move (distanceTo(mole))

Create Your Own Function Exercise 6-1 #2 Create a new world with a car or truck. Write a program to make the 4 wheels of the car realistically turn forward as the car moves forward. Why a function??? Roll and move forward at the same time doesn’t look realistic. When cars move the tires do not rotate at the same rate as the car is moving forward Rotation must be based on the size of the tires (distance / (3.14 * diameter))

Create Your Own Function Like Creating a Method Select Object in Object Tree Select Functions from Details Window Create New Function

Create Your Own Function Name Type  Return Type Must have a Return Type Number Boolean Object Other

Coding Function Code Function Cannot Delete the Return Statement All functions return some Information

Call the Function Function Call