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

Added 11l
(Add BCPL)
(Added 11l)
Line 12:
*   [[Bulls and cows/Player]]
<br><br>
 
=={{header|11l}}==
{{trans|Python}}
 
<lang 11l>V (target_min, target_max) = (1, 10)
V (mn, mx) = (target_min, target_max)
 
print(
‘Think of a number between #. and #. and wait for me to guess it.
On every guess of mine you should state whether the guess was
too high, too low, or equal to your number by typing h, l, or =
’.format(target_min, target_max))
 
V i = 0
L
i++
V guess = (mn + mx) I/ 2
V txt = input(‘Guess #2 is: #2. The score for which is (h,l,=): ’.format(i, guess)).trim(‘ ’).lowercase()[0]
I txt !C ‘hl=’
print(‘ I don't understand your input of '#.' ?’.format(txt))
L.continue
I txt == ‘h’
mx = guess - 1
I txt == ‘l’
mn = guess + 1
I txt == ‘=’
print(‘ Ye-Haw!!’)
L.break
I (mn > mx) | (mn < target_min) | (mx > target_max)
print(‘Please check your scoring as I cannot find the value’)
L.break
 
print("\nThanks for keeping score.")</lang>
 
{{out}}
<pre>
Think of a number between 1 and 10 and wait for me to guess it.
On every guess of mine you should state whether the guess was
too high, too low, or equal to your number by typing h, l, or =
 
Guess 1 is: 5. The score for which is (h,l,=): l
Guess 2 is: 8. The score for which is (h,l,=): l
Guess 3 is: 9. The score for which is (h,l,=): l
Guess 4 is: 10. The score for which is (h,l,=): =
Ye-Haw!!
 
Thanks for keeping score.
</pre>
 
=={{header|Ada}}==
1,480

edits