Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 37 - Ai Robogenius
P. 37

    Let us look at some examples.

                     Example 1: Baking a Cake

                     When you bake a cake, timing is everything. If you don’t wait for the cake to bake
                     long enough, it might be raw in the middle. But if you leave it in the oven too long, it
                     could burn!

                     Here’s how timing works when baking a cake:

                     1.   Mix the ingredients and pour the batter into the
                        pan.

                     2.   Set a timer for the cake to bake for about 30
                        minutes.

                     3.   Wait for the timer to go off, then take the cake out of the oven.

                     4.   Allow it to cool before frosting or eating it.
                     If any of these steps are missed, such as starting to frost the cake before it’s fully

                     baked, the result will not be the same.

                     Example 2: Programming a Robot

                     When you give instructions to a robot, you must to tell it what to do and when to
                     do it. If you program a robot to move forward but forget to tell it to stop, the robot

                     might keep going and crash into something.
                     Here’s a steps for programming a robot to move:

                       STEP - 1   Start by instructing the robot to move forward.

                      STEP - 2   After it has moved a short distance, tell it to turn right.

                      STEP - 3   Once it finishes turning, command the robot to stop.

                     If you tell the robot to turn right before it starts moving, it won’t know where to go.

                     Similarly, if you tell it to stop too soon, it might not reach the desired destination.

                                                                            Logical Thinking and Early Algorithms
                                                                                                                        35

| 32 33 34 35 36 37 38 39 40 41 42 |