have you tried outputting the value of $thinkingof during each guess? This will help you to at least ensure that the randomness works.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
aha, maybe you should put the entire thing inside of the while loop ;)
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
I agree with Comatose, you should probably put the part that prompts for and accepts new input inside the loop somehow. That way as the loop is run again you ask for input again.
The psuedo-code looks something like:While the user has not guessed the number
Prompt for a guess
Accept the guess
Compare the guess and report one of:too low
too high
That's it
And as far as printing thinking of, I usually give it its own print statement right after it was generated with the word DEBUG in the output so it helps to remind me to take it out later. Something like print "DEBUG: thinkingof $thinkingof\n";
Murtan
Practically a Master Poster
671 posts since May 2008
Reputation Points: 344
Solved Threads: 116
int(rand 10) returns numbers in the range 0 to 9
int (rand 10)+1 returns numbers in the range 1 to 10
while(1) is a continuous loop...it will keep looping until you 'break' or 'last'.
Murtan
Practically a Master Poster
671 posts since May 2008
Reputation Points: 344
Solved Threads: 116