Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   How do I have Alice Calculate a Math Problem (http://www.alice.org/community/showthread.php?t=3841)

rossim0 01-30-2010 12:41 PM

How do I have Alice Calculate a Math Problem
 
1 Attachment(s)
I have already done the animation to this project. I need the work to ask how many miles it may be to a place. Then, what is the speed limit. These i guess would be two separate variables. Then the person in the program divides the speed limit by the miles and comes up with a time it will take to get to the place. They cant be fixed numbers because it has to work for any random numbers. So in order...

Miles are asked for input by the user
Speed Limit is asked for input by the user
car drives up
person turns to car, and then away
Person then answers equation which is basically speed limit divided by miles

Just having an issue getting division equation into this program.

I have attached my file & would appreciate any help. I'm really bad with variables. Thanks a lot.

zonedabone 01-30-2010 06:00 PM

Ok! I'm here to help.

First, you're going to want to make variables. Go into the world's properties, and select create variable. Type the name "Distance" into name, and select number as the type. Repeat this process, except name it "Speed"

Next, drag the "Distance" variable into the event, end set it's value to anything. Go into the world's functions, and drag "Ask user for a string" into the number box. Click other, and type a question about the distance. Repeat this for the "Speed" variable.

Third, drag the variable "Distance" set it's value to itself, found under expressions. click on this reference, and select math. Click "Distance/", and select time under expressions.

Where you want it have the zombie say something. Under the world's functions, drag"What as a string" into the value. Drag distance into that. You're done!:D

rossim0 01-30-2010 10:50 PM

A few issues with your reply
 
1 Attachment(s)
I really appreciate you taking the time to help me out, but I am having some issues, I have uploaded what i have done so far following your guidelines.

1. When I create the distance variable and add it into my "world.my first method" as the first method, I am not able to put ask user for a string int he number section, it doesn't accept it. If you check out my program I uploaded you will see what I have done to try and make it work.

2. Also, it seems that we are missing a A Time variable. Miles / Speed limit = Time. I don't know how to finish the program. I have got it so I input the numbers for speed and miles, how do I input the zombie saying the answer for the equation. Please if you have some time, checkout my program I made and let me know what I'm doing wrong. Thanks a lot. Cant tell you how much i appreciate your help.

zonedabone 01-31-2010 05:17 PM

Oh! I'm so sorry! I accidently typed the wrong thing. I meant to say "Ask user for a number." Sorry!

I see that you successfully added the time variable. Drag this so that it's after the first two questions. Right click on "World.distance" within your time function, and then click on math. Click distance/, click expressions, and then speed. The variable will now be set as distance/speed.

The say bubble will be very advanced, but for now, simply have the zombie say something where you want him to. Next, drag "What as a string" from the world's functions into his text to say. Go to expressions, and select time.

Hope this helps!

Deathlaser 05-06-2012 12:29 PM

How?
 
How do I get alice to calculate simple math problems like 4+5

Like the user types in "4" and "+" and "5"

Hurry, I only have till tuesday.


All times are GMT -5. The time now is 11:41 PM.

Copyright ©2020, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.