Guess the number/With feedback (player): Difference between revisions

Add BASIC
(Removed reference to module "rdstdin" which is not documented.)
(Add BASIC)
Line 219:
Guesses: 7
</pre>
 
=={{header|BASIC}}==
<lang basic>10 DEFINT A-Z
20 INPUT "Lower limit? ",L
30 INPUT "Upper limit? ",H
40 IF L>H THEN PRINT "Invalid input": END
50 PRINT "My guess is ";(H-L)\2+L
55 T=T+1
60 INPUT "Too low (L), too high (H), or correct (C)? ",R$
70 ON INSTR("LlHhCc",R$) GOTO 90,90,100,100,110,110
80 PRINT "Invalid input": GOTO 50
90 L=(H-L)\2+L: GOTO 40
100 H=(H-L)\2+L: GOTO 40
110 PRINT "It took";T;"tries."</lang>
{{out}}
<pre>Lower limit? 1
Upper limit? 100
My guess is 50
Too low (L), too high (H), or correct (C)? L
My guess is 75
Too low (L), too high (H), or correct (C)? L
My guess is 87
Too low (L), too high (H), or correct (C)? H
My guess is 81
Too low (L), too high (H), or correct (C)? L
My guess is 84
Too low (L), too high (H), or correct (C)? L
My guess is 85
Too low (L), too high (H), or correct (C)? C
It took 6 tries.</pre>
 
=={{header|BBC BASIC}}==
2,094

edits