![]() ![]() To simplify this algorithm, use a for-each loop to repeat the commands needed to draw a square. ![]() Then modify the ButtonDraw.Click handler so that it calls the square40 procedure. Then implement your algorithm by defining a procedure named square40 that draws a 40-by-40 square. 40x40 Square: Design an algorithm for drawing a 40-by-40 square. ![]() Download and print this graph paper to use when designing your algorithms in the following exercises. Exercises (Pair Programming)Īfter doing the tutorial above, you have drawn 20x20 square using a loop and then refactored the code to use procedural abstraction to create the procedure square20.įor these exercises below, before coding your solution in App Inventor, it would be a good idea to first write out the solution in pseudocode and discuss it with your coding partner. The for-each block in this case repeats the statements in its do-slot 4 times. The algorithm on the left uses a simple sequence with copies of the forward and turn blocks to draw a square, whereas the algorithm on the right uses repetition, a for-each counting loop, a much more practical and general approach. Note the big difference between the two algorithms below. Just about any algorithm you can think of can be built using these three types of controls.Īs you saw in the tutorial, procedures and loops made drawing a square much easier than using a list of commands. There are three basic types of control structures in designing algorithms: sequence, selection, and repetition. DO NOT OPEN OR EDIT THESE BLOCKS! You can either watch the video tutorial, read the text tutorial or use the short handout. When the template opens, you will see a lot of collapsed blocks. If you are using iOS companion, please change the Canvas Height property to Fill Parent instead of 100% so it does not cover the buttons. ![]() aia file, go to App Inventor and do File/Import and import in the downloaded. If the template does not open, download the. Open App Inventor with the Logo 1 Template in a separate tab and follow along with the tutorial below. Think about a better abstraction for drawing shapes. Think about how you would improve the drawing language that is, help us You can also write your own libraries of code to use in other App Inventor projects using the backpack feature to share them.ĭeliberately created a fairly weak abstraction – one that lets youĭraw shapes, but only with some difficulty. The use of libraries already written for you simplifies the task of creating complex programs. A software library contains procedures that may be used in creating new programs. The App Inventor template below has these Logo Commands already written for you.Įxisting code segments that you can use are often called libraries. Taken together these commands constituteĪn abstraction – a language – for drawing shapes. The Logo programming language consists of a set of primitive commands thatĬontrol the turtle. Very sophisticated drawings, such as the pattern on the left. Logo can be used to create very sophisticated algorithms and Imagine the trail left behindīy an animal as it moves around in the sand on a beach. It leaves behind a trail, in other words it draws. That the user can control by telling it how to move. Logo’s best known feature is its turtle, an actual picture of a turtle, In this lesson the tangible objects you will build are algorithms for drawing That help us create our own mental models to understand the world around us. Our own knowledge and ideas – when we build tangible objects Papert believed that we learn best when we are building This is followed by an experiment lesson where an app that repeatedly “flips” a coin is used to assess the quality of App Inventor’s PRNG Students learn how one’s privacy is impacted by developing technology and computing innovations and students learn the economic, social and cultural effects of computing innovations, such as real world models of the weather and the solar system.Is a programming language that was invented in the 1960s by Seymour Papert primarilyįor educational use. The activities in this unit build toward EU AAP-3 as students learn that models and simulations use abstractions, such as a pseudo random number generator (PRNG), to represent real world situations, in this case, the flipping of a coin Students learn how PRNG algorithms are used to model randomness inside a computer, such as with the Coin Flip app Students extend the app model to represent different types of coins, including a biased coin and a three-sided coin. The Coin Flip app, which extends over several lessons, introduces the concept of modeling. The LightsOff app introduces the idea of computer simulation with a computational variation of the traditional Whack-a-Mole game. This unit focuses on animation, simulation and modeling. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |