Presentation is loading. Please wait.

Presentation is loading. Please wait.

Distributing (Fun + Learning): The Distributive Property By: Peggy Li Under the direction of Professor Susan Rodger Duke University, June 2011 1.

Similar presentations


Presentation on theme: "Distributing (Fun + Learning): The Distributive Property By: Peggy Li Under the direction of Professor Susan Rodger Duke University, June 2011 1."— Presentation transcript:

1 Distributing (Fun + Learning): The Distributive Property By: Peggy Li Under the direction of Professor Susan Rodger Duke University, June 2011 1

2 Overview This tutorial will help you make an Alice world that lets you practice the distributive property. An expression in the form a(bx+c) will appear, where a, b, and c are nonzero integers. A possible answer for the expanded form will also show up. The user clicks Y if he/she thinks it is right, and N if he/she thinks it is wrong. Concept can be further developed to practice more advanced concepts like adding algebraic expressions or using fractions. 2

3 1.Open Alice and create a new world. 2.Select a template of your choice. (This tutorial uses Grass, but any other works too.) 3.Click Open to start building your world. 4.Remember to save your world somewhere you can find it later! Creating a new world 3

4 1.Click the green Add Objects button. 2.In the Local Gallery, scroll to the right until you reach the People folder. Click on the folder. 3.Scroll to the right until the very end. 4.You can use hebuilder and shebuilder to create your own character. Adding a person 4

5 Just a quick explanation! You might have noticed there are lots of other cool people to choose from in the People folder! We’re going to use the Character Builder because it comes with some built-in methods that will be helpful later on. Once you’re comfortable working in Alice, you can use an existing character and create new methods for it. Why hebuilder/shebuilder 5

6 1.Customize your person! You can choose: Body: head, torso, and legs Face: skin tone, eyes, and lips Hair: length/style and color Clothing: shirt, pants, and shoes 2.Give your character a name and enter your name in the Created By box. Now click OK! Note: The person in this tutorial is named Guide. This will come up in future slides. Customizing your person 6

7 1.Your person’s arms will be spread out like in the picture. Let’s move them back down to his/her side. 2.Find the Object Tree on the left. 3.Click the + next to your person’s name, then click the + next to upperBody and Chest. 4.You should now see parts called rightUpperArm and leftUpperArm. Rotating the arms 7

8 1.Right-click on rightUpperArm in the Object Tree. 2.Now go to Methods, select roll, and right. Click on Other and type in 0.2. 3.Do the same for leftUpperArm, but this time roll it to the left, again by 0.2. 4.Your person’s arms should look like this: Rotating the arms 8

9 1.Click on Add Objects again and return to the Local Gallery. 2.Scroll all the way to the right until you reach Create 3D Text, and click that. 3.Enter “a(bx+c)= ” for the text. 4.If you want, you can change the font. The tutorial will use Arial bold. 5.Make another 3D Text that says “abx+ac”. Adding 3D text objects 9

10 1.In the Object Tree, right-click on the first 3D Text you made and rename it “expression”. 2.Rename the second one “answer”. 3.Right-click on expression in the Object Tree. Go to Methods >> turn to face >> camera. 4.Repeat Step 3 for answer. 5.Both objects should now be facing you. Renaming and turning 3D text 10

11 1.Locate the object control buttons. Use them as needed to move and resize the objects until they look roughly like this: Repositioning objects 11

12 1.We can change the color of the expression and answer text objects. 2.To do this, click expression in the Object Tree and go to the Properties tab. 3.Click the arrow next to color and choose any color. This tutorial will use blue. 4.Do the same for answer. The tutorial will use magenta. Changing 3D text color 12

13 1.Now let’s make two answer buttons: one Y (yes/correct) and one N (no/wrong). 2.Go to Local Gallery >> Shapes folder and add two squares to your world. 3.Rename them yesButton and noButton. 4.Turn both squares to face the camera by right-clicking and going to methods >> turn to face >> camera. 5.In their Properties tabs, change the yesButton color to green and the noButton color to red. Making answer buttons 13

14 1.Now create two new 3D text objects, one that says “Y” and the other that says “N”. You can choose a font; the tutorial uses Arial, bold. 2.Rename them Yes and No and them to face the camera. 3.Move and resize them so that each is directly in front of the corresponding square. 4.Under Properties, set the vehicle of Yes to yesButton and No to noButton. This “glues” the letter to the square. Making answer buttons 14

15 1.Move the answer buttons forward and/or down (resize if needed) so they look like this: Positioning answer buttons 15

16 1.Let’s make a new method that will give us a random expression in the form a(bx+c). 2.Click on world in the Object Tree, go to the methods tab, and click create new method with the name getExpressions. 3.Click create new variable and make a new variable with name a and type number. Set its value to 0 (select other and type in 0). 4.Make two identical variables called b and c. Getting a random expression 16

17 1.Now we’ll set random values for a, b, and c. 2.Drag a while into the method and select true. 3.From the variables list, drag a over true, select a ==, and set b to 0. Setting random numbers 17

18 1.Drag another a, this time into the while loop. Select set value, and choose any number (we will change this in a moment). 2.Go back to world in the object tree. Under the functions tab, find the random number (under the third section Random). 3.Drag random number into the method, over the value you set a equal to. Setting random numbers 18

19 1.Click the more right next to random number and set the minimum to -10. 2.Repeat Step 1 to set the maximum to 11 and integerOnly to true. 3.When we get a random number, it can include the minimum, but goes up to not including the maximum. Here we want numbers from -10 to 10, so maximum = 11. 4.We want integerOnly so the numbers are easy to work with – not long decimals! Setting random integers 19

20 1.Click the more arrow at the end of the line and set duration to 0 seconds. 2.Drag the entire while loop to the clipboard in the upper right, to “copy” the contents. 3.Drag the clipboard back into the method, under the while loop, to “paste” the contents. 4.Repeat Step 3. You should have a total of three while loops in the method right now. Getting a random expression 20

21 1.In the second while, change both instances of a to b. Then, in the third while, change both instances of a to c. 2.The while statements ensure that a, b, and c are all nonzero so we don’t get anything too easy like 0(0x+2). Remember that a, b, and care were all set to 0, so the while loop makes sure a new number is generated until the variable is no longer equal to 0. Getting a random expression 21

22 1.Now create two new number variables and name them ab and ac. Set both values to 0. 2.Drag ab into the method (below third while), and select set value >> expression >> a. 3.Click the arrow by a and choose math >> a* >> expression >> b. This just means a x b. 4.Repeat Steps 2-3 for ac, but remember to choose c instead of b. 5.Set the duration for both ab and ac to 0. Getting a random expression 22

23 1.Go to world’s functions tab, and scroll down until you find absolute value of a in Math. 2.Drag absolute value into the method, over the entire a*b (not just a). Repeat for a*c. 3.This means that ab and ac are both positive. We do this for formatting reasons, as we will see shortly. Getting a random expression 23

24 1.Create five new variables, all type String and set to default value. Name them aString, bString, cString, abString, and acString. 2.Drag aString into the method and set its value to default string for now. 3.Under world’s functions, find and drag the what as a string over default string. Choose expressions >> b. 4.Repeat steps 2-3 for the other four variables. Make sure you use the matching number! 5.Set the duration for each line to 0. Getting a random expression 24

25 1.Scroll to the bottom of world’s functions and find int a as a string. Drag this over a, b, c, ab, and ac in the five lines and reselect the right variable name in expression. 2.What this does is remove the decimal format that otherwise comes with making an integer a string using just what as a string. In other words, when 4 becomes a string, it is now just 4 instead of 4.0. 3.You do need to keep what as a string in addition to int a as a string. Casting integers to strings 25

26 Setting integers as strings 26 This is how the last five lines should look now. Make any changes or corrections if needed.

27 1.Drag an if/else into the method. Formatting the expression 27

28 1.Go back to world’s methods tab and create a new method called shuffle. This will put the answers in random order in the array. 2.Click create new parameter to make a new parameter named answerArray. Make it an array of type Other >> String. Shuffling the answers array 28


Download ppt "Distributing (Fun + Learning): The Distributive Property By: Peggy Li Under the direction of Professor Susan Rodger Duke University, June 2011 1."

Similar presentations


Ads by Google