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???
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.
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...