Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Please help quick (advanced stuff)
Old
hydude777
Member
 
Status: Offline
Posts: 25
Join Date: Apr 2011
Default Please help quick (advanced stuff) - 02-17-2012, 10:45 PM

okay here is what i have to do,

i have a world where a kangaroorobot randomly chooses a number between 1-100, and i have to guess it correct.
everytime i guess a number lower than the secret number, the kangaroo says, "too low". and it goes the similar for when i choose a higher number.
after i guess it correct, the kangaroorobot says how many tries it took me to guess it correct.

THe thing here now, is that I want to make it SPEAK OUT the numbers, in sound.
yes,,, 1 to 100,, integers.
In order to achieve that, I do not want to make 100 IF statements and make each sounds for each number, but I want to do this...
firstly, record
one, two, three.....eight, nine sounds
then ten, eleven, twelve, thirteen....eighteen, nineteen sounds
then twenty, thirty, forty....eighty, ninety sounds
then lastly hundred.
to make the sound for 46 for example, i would need to combine "forty" and "six".

but how would I achieve this???????????
do I need to use the ARRAY or LIST in the sound variable/property???
for "forty"+"one","two","three"...."eight","nine"
how do i do it???

PLEASE HELP ASAP
Attached Files
File Type: a2w kangaroo numbers.a2w (4.65 MB, 5 views)
   
Reply With Quote
Old
Mr Kidnapper
Senior Member
 
Status: Offline
Posts: 442
Join Date: Feb 2011
Default 02-18-2012, 02:12 AM

Seems pretty simple to me.
Make random number.
Make if statement.
Check if inputted number is equal to the random number.
Yes? Correct.
No? In the else statement, put another if. Check if inputted number is less than the random number.
Yes? Too low.
No? In the else statement, put another if. Check if inputted number is higher than the random number.
Yes? Too high.
No? Not possible. Ignore it.

For the number array thing you have to separate the inputted number into a two index array.
You can do this the same way you might get change for twenty five dollars. First, divide the number by 10 and get an integer (whole number, no decimal). This is the first index. Then, use the IEEE remainder function to divide the same number by 10. This is the second index.
Now what's in the first index? If it's zero, play nothing.
If it's one, play "ten".
And so on.
If it's ten, play "one hundred"
Now what's in the second index? If it's zero, play nothing.
If it's one, play "one"
If it's nine, play "nine"
If it's ten, that shouldn't happen. Otherwise it would be zero.
Make sure to include special events for 11-19, such as before checking first and second index, check if the numbers are "1 and 1" or "1 and 9" and play the related sounds. Put the first two methods in the else box so they only happen in the event that the number isn't 11-19.

Last edited by Mr Kidnapper; 02-18-2012 at 02:21 AM.
   
Reply With Quote
Old
hydude777
Member
 
Status: Offline
Posts: 25
Join Date: Apr 2011
Default 02-18-2012, 02:41 PM

i already did the first part, but the second part i couldn't...
'
never thought of dividing the number by 10 and separating it to two different indices...


Wow.... you're a genius...
thanks!
   
Reply With Quote
Old
hydude777
Member
 
Status: Offline
Posts: 25
Join Date: Apr 2011
Default 02-20-2012, 05:03 AM

I kind of get what Mr.K told me, but if I try to move his words to action, it doesn't quite seem to work for me

can someone make the world he explained?
   
Reply With Quote
Old
hydude777
Member
 
Status: Offline
Posts: 25
Join Date: Apr 2011
Default 02-20-2012, 07:13 AM

I found a bug on your method Mr.K........


Whenever my secret number is 99, the IEEE remainder after dividing it by 10 becomes -1, not 9....


and I soon found out that if the 1st digit is 9, e.g. 79,89,99, the IEE remainder won't work properly.
remainder becomes -1...
   
Reply With Quote
Old
hydude777
Member
 
Status: Offline
Posts: 25
Join Date: Apr 2011
Default 02-20-2012, 07:20 AM

also found out that whenever the secretnumber's 1st digit is at least 5, the remainder becomes a negative value



I did this, I made two variables to store the two values I get after separating the secret number into two., tens digit, ones digit.

then did
'ones digit' set value to IEERemainder of 'secretnumber/10'
if the number is 76, the ones digit value becomes -4
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



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