Talk:Guess the number/With feedback (player): Difference between revisions
Content added Content deleted
Walterpachl (talk | contribs) (→REXX solution: new section) |
Walterpachl (talk | contribs) (REXX compliance and logic improvement) |
||
Line 6: | Line 6: | ||
changing Upper info to info=translate(info) makes it work for all Rexxes I know |
changing Upper info to info=translate(info) makes it work for all Rexxes I know |
||
and these hanges improve it |
and these hanges improve it |
||
if pos('HIGH',info)\==0 then newhigh=guess |
if pos('HIGH',info)\==0 then newhigh=guess |
||
if pos('LOW' ,info)\==0 then newlow =guess |
if pos('LOW' ,info)\==0 then newlow =guess |
||
to |
to |
||
if pos('HIGH',info)\==0 then newhigh=guess-1 |
if pos('HIGH',info)\==0 then newhigh=guess-1 |
Revision as of 06:26, 1 July 2012
C code, -Wall, and end of main()
Hitting "Y" is not the only way to end main(). Try ctrl-D, and your program will exit with code 255 (or whatever eof is). Generally, using scanf() for interactive input is a bad idea, just so you know. --Ledrug 21:57, 28 June 2011 (UTC)
REXX solution
changing Upper info to info=translate(info) makes it work for all Rexxes I know and these hanges improve it
if pos('HIGH',info)\==0 then newhigh=guess if pos('LOW' ,info)\==0 then newlow =guess
to
if pos('HIGH',info)\==0 then newhigh=guess-1 if pos('LOW' ,info)\==0 then newlow =guess+1
--Walterpachl 06:25, 1 July 2012 (UTC)