Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Scratch Programming Session 5 of 10 Review + Multiple Sprites Objectives for Session 5 • Review Binary • Review Algorithms • Multiple sprites Binary • What is Binary? • What Numbers are used in Binary? Binary conversion Algorithm 0 r 1 • Convert 25 into binary 1 r 1 – 1/2 = 3 r 0 – 3/2 = 6 r 0 – 6/2 = 12 r – 12/2 = – 25/2 = • 25 in Binary is 11001 1 Try these examples on your own: • Convert to Binary: 36 52 67 1342 • Bonus: convert this from binary to decimal 110011 The other way around • How do you convert 11001 into Base 10 (our number system)? 16 8 4 2 1 1 1 0 0 1 • 16+8+0+0+1 = 33 Try these numbers • 010101 • 011111 • 000011 32 16 8 4 2 1 Game The number must be: Less than 7 digits in binary or Less than 100 in Base 10 • 2 Teams (Left Side vs. Right Side) • Each team comes up with a number, in binary or in base 10 • The other team has to convert it. • 30 seconds to answer • Highest Score after 5 rounds wins! ASCII • ASCII stands for the American Standard Code for Information Interchange • It’s a way for computers to represent letters or characters in Binary • Each letter or symbol gets a specific sequence of numbers ASCII • Example – The character “A” is represented in binary as 01000001 – The character “a” is represented as 01100001 • All the characters are represented in some form of this binary code Activity • Close Scratch •Dr. Stockman’s Block Coding Activity Algorithms • What are Algorithms again? – Instructions or Recipes for how to do a specific thing, such as find the area of a square • What Algorithms have we done before? – Area of a Square, Perimeter, Area of a triangle, Average number of people • What other Algorithms can you think of? Variable Practice • Let’s calculate the distance between 2 points • First, we ask the user for point 1 – Ask “What is point 1” and wait • Then we save that as a variable – Set point1 to answer • Now do the same for Point 2 Variable Practice Cont. • Now we need to find the distance between the 2 points – Set Result to Point2 – Point1 – Say Result Exercise: Calculate Average Age • Calculate the Average of two ages • Hints: – 3 Variables (Age1, Age2, Result) – Ask for Age1 and Age2 – Average of 2 ages is (Age1+Age2)/2 – Say the Result • Show us when you’re done BONUS: Can you make it average more than 2 people? Multiple Sprites • So far, we’ve only been using a single sprite to do everything. • Scratch is designed to handle more than one Sprite Adding A new sprite • On the bottom left panel of scratch, click “import sprite” • Choose the sprite you want to import • Click “okay” Important things to know • Notice that the scripts from your first sprite are NOT visible when you have this sprite selected • Any scripts you add to this sprite will only work with THIS SPRITE. Naming your sprites • Something helpful when you have multiple sprites is Naming them something you’ll recognize later. • Lets do this now: Changing a Sprite’s name • Click on the sprite whose name you want to change • Click in the Box near the sprite’s picture • Type in the new name and hit enter Review • You now know: – How to convert a number to and from binary – How computers recognize numbers and letters – How to make an algorithm in Scratch – How to add additional sprites to your Scratch Program