1 / 16

24 Background Building 25 Computing Terminology, and Speed/Velocity 26

Table of Contents. 24 Background Building 25 Computing Terminology, and Speed/Velocity 26 27 Module 4 Notes: Sensing, Or Operator, Conditional Logic 28 29 30 31 32 33 34 35 36 37 38 39. 2. Module 4 Notes: Sensing, Or Operator, Conditional Logic. Sensing.

arich
Download Presentation

24 Background Building 25 Computing Terminology, and Speed/Velocity 26

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Table of Contents 24 Background Building 25 Computing Terminology, and Speed/Velocity 26 27 Module 4 Notes: Sensing, Or Operator, Conditional Logic 28 29 30 31 32 33 34 35 36 37 38 39 2 Module 1

  2. Module 4 Notes: Sensing, Or Operator, Conditional Logic

  3. Sensing • These tools are used to detect something • Sprites touching sprites • Sprites touching colors • User key entries • User text entry (i.e. Module 2)

  4. Operators: Or • We use these to help make decisions • Checks to see if something is true • Or: this checks if one condition is true OR another condition is true • We can put multiple Operators together

  5. Conditional Logic: Wait Until • Located under Control tools • Conditional Looping: Repeat functions over and over again in your program for some desired effect. • Wait Until: keeps checking until the condition is true. Then is performs an action.

  6. Conditional Logic: If • A type of Conditional Logic • Acalculation that uses IF-THEN-ELSE logic like in Module 3. • But this one only has IF • Your program does what ever is inside of it, IF the variable is true.

  7. Stop Script • This tells Scratch to stop that piece of code from multitasking • If too many tools are multitasking it will slow down your computer • Stop Script stops processes (jobs) that do not need to be completed or are done

  8. Module 4 Notes: Algorithms, Functions, and Control Tools

  9. Left Side Activity 1 • Describe in detail what a normal school day is like: (answers will vary) • What major things do you always do on your own? (answers will vary) • What major things does the school make you do on a daily basis? (answers will vary, but we do daily announcements, five minutes periods, etc) • What do you do first in this formula: (3 + 4) x (2 x 4) (we want them to think of PEMDAS and the steps they follow to finish the formula) • What is a job? (answers will vary) • If we do more than one job at a time what is that called? (multitasking or parallelism)

  10. Algorithms • A set of rules that define a sequence of steps that have to be done • This is basically what your daily schedule looks like at school. • In Math: it is step-by-step procedure for calculations like PEMDAS • In MIRD: The computer will go through steps to create some output. We program the steps in Scratch • This Algorithm will receive Yellow broadcast • Switch costumes and • The output is that it shows the costume

  11. Functions • A function completes a job • A function completes a process • When you put multiple algorithms (steps) together they create functions • Algorithms tell how the function works • Math: a function is also a formula like the formula for speed: • Speed = Distance/Time • This function tells us how fast something goes • MIRD: our computer programs can have hundreds or thousands of functions (see next slide) • Functions use all of the tools in Scratch

  12. All of these are functions for one sprite

  13. Function Examples • What is this functions job? • It resets the three variables back to zero. • What is this functions job? • It tells the sprite to go to a certain XY coordinate and then glides to the coordinates given

  14. Left Side Activity 2 • What type of jobs do computer do in our lives: (answers will vary) • What type of jobs do we want computers to do and not stop? (answers will vary, some might be sewage treatment, air traffic control, electrical plants, television stations, web servers, medical equipment, etc.) • Give an example of when you made a decision based upon another decision (start by using IF): (Give an example of your choice, here is one if you are short on time: if I won a million dollars from the lottery, then I will have to decide if I want to buy a new house or if I want to buy a fancy car or save my money; if I don’t win a million dollars then I have to decide if I will buy another lottery ticket, or if I will go find a better paying job).

  15. Forever Loop • These control tools run Forever • They never stop unless we tell them to stop • It keeps running our function by starting over after it completes it • We will use Forever to check if we are touching another sprite • In our program we will need to forever to keep checking if the finish line is touching the winning sprite

  16. Embedded IF/ELSE conditions • Embedded means something is inside of something else • A hamburger is embedded within a bun • We embed IF/ELSE conditions to make multiple decisions • Think of our examples from the left side 2 • A decision based upon another decision • Conditional Logic: a condition based upon another condition Example • If: touching Sprite 2: Turn right 15 degrees • Else: If: touching Sprite 3: change color effect • Else: say “I’m touching nothing”

More Related