- Optimization Ideas?
- 25 Jun 2006 08:33:13 pm
- Last edited by CalcMan06 on 25 Jun 2006 11:04:19 pm; edited 1 time in total
I already ran my program through the SourceCoder, but I know that the SourceCoder's not perfect. Here it is:
::DCS
:FF818181818181FF
:ClrHome
:Input "Maximum?",U
:While U≤1
:Disp "Invalid number.
:Input "Try again.",U
:End
:1→E
:randInt(0,U→R
:Input "Guess my num.",G
:While G≠R
:While G>U or G<0
:Disp "Invalid number.
:Input "Try again.",G
:End
:If G>R
:Then
:Disp "Too high.
:Input "Try again.",G
:E+1→E
:End
:If G<R
:Then
:Disp "Too low.
:Input "Try again.",G
:E+1→E
:End
:End
:Disp "Wow, you got it!
*****:Disp "In",E,"tries!*****
:Repeat getKey
:End
:ClrHome
:Output(1,1,"
:DelVar GDelVar RDelVar UDelVar E
This is a guessing game in which you input the maximum number that the randInt( can generate, and then proceed to guess the number. I'm most concerned about the code in between the stars. Any optimization ideas?
GUESGAME wrote:
::DCS
:FF818181818181FF
:ClrHome
:Input "Maximum?",U
:While U≤1
:Disp "Invalid number.
:Input "Try again.",U
:End
:1→E
:randInt(0,U→R
:Input "Guess my num.",G
:While G≠R
:While G>U or G<0
:Disp "Invalid number.
:Input "Try again.",G
:End
:If G>R
:Then
:Disp "Too high.
:Input "Try again.",G
:E+1→E
:End
:If G<R
:Then
:Disp "Too low.
:Input "Try again.",G
:E+1→E
:End
:End
:Disp "Wow, you got it!
*****:Disp "In",E,"tries!*****
:Repeat getKey
:End
:ClrHome
:Output(1,1,"
:DelVar GDelVar RDelVar UDelVar E
This is a guessing game in which you input the maximum number that the randInt( can generate, and then proceed to guess the number. I'm most concerned about the code in between the stars. Any optimization ideas?