Computer Science Canada Guessing game! need a new random number after the first round. |
| Author: | nelsonkkyy [ Thu Oct 04, 2012 6:39 pm ] | ||
| Post subject: | Guessing game! need a new random number after the first round. | ||
I keep playing till the second round and so on, the secret number still remains the same. How do I generate a new one? |
|||
| Author: | Insectoid [ Thu Oct 04, 2012 6:48 pm ] | ||
| Post subject: | RE:Guessing game! need a new random number after the first round. | ||
Try moving that outside the loop. |
|||
| Author: | nelsonkkyy [ Thu Oct 04, 2012 7:40 pm ] | ||
| Post subject: | Re: Guessing game! need a new random number after the first round. | ||
Do you mean by that? I tried it and it still doesn't work. |
|||
| Author: | Insectoid [ Thu Oct 04, 2012 7:55 pm ] | ||
| Post subject: | RE:Guessing game! need a new random number after the first round. | ||
Oops, my bad.
Try moving that line into the 2nd loop. |
|||
| Author: | nelsonkkyy [ Thu Oct 04, 2012 7:58 pm ] |
| Post subject: | Re: Guessing game! need a new random number after the first round. |
But that will changes the secret number every time i make a guess |
|
| Author: | Insectoid [ Thu Oct 04, 2012 8:15 pm ] |
| Post subject: | RE:Guessing game! need a new random number after the first round. |
When is 'reply' ever false? |
|
| Author: | nelsonkkyy [ Thu Oct 04, 2012 8:22 pm ] |
| Post subject: | Re: Guessing game! need a new random number after the first round. |
But even if i change the guess == false to replay == false, it wont make any different |
|
| Author: | Insectoid [ Thu Oct 04, 2012 8:33 pm ] | ||
| Post subject: | RE:Guessing game! need a new random number after the first round. | ||
Oh, I found the actual problem at last.
Have a good look at that code, and tell me when your loops exit. |
|||
| Author: | nelsonkkyy [ Thu Oct 04, 2012 8:44 pm ] |
| Post subject: | Re: Guessing game! need a new random number after the first round. |
i don't see anything there so when i type yes to replay the game and if i type no for the (guess = false / reply = false) it stops? |
|
| Author: | TokenHerbz [ Thu Oct 04, 2012 10:15 pm ] | ||
| Post subject: | RE:Guessing game! need a new random number after the first round. | ||
|
|||