having fun with the HP17b  Printable Version + HP Forums (https://archived.hpcalc.org/museumforum) + Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum1.html) + Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum2.html) + Thread: having fun with the HP17b (/thread185590.html) 
having fun with the HP17b  Don Shepherd  06072011 How about a "guess the number 099" program for the 17b (and 17bii) solver. At first glance, you would think it might not be possible due to: lack of a random number function, lack of alpha messages to tell you if you are too high or too low, and lack of a "beep" instruction when you correctly guess the number. Plus, the 17b is not programmable, right? Lack of random number function is overcome by using current time (minutes, seconds) and the MOD function. Lack of alpha capability is overcome by returning 1 if your guess is too low and 1 if it is too high (yes, it's not ideal, but it works). A "beep" is generated by doing a Log(0) which generates an error message and halts evalution of the equation (AFTER saving the number of guesses in variable GUESS so it can be recalled). The equation works on the 17b and 17bii. It mostly works on the 17bii+ except the number of guesses is wrong due to the way the solver in the 17bii+ works (or doesn't work, actually).
Press INIT a couple of times (not sure why that is necessary) then enter your guess and press GUESS. Then press EVAL to evaluate your guess: 1 means you are too low, 1 means you are too high, and a beep means you guessed the number so do a RCL GUESS to see the number of guesses it took.
What is the maximum number of guesses it should take to identify the number from 0 to 99? Edited: 7 June 2011, 8:31 p.m. after one or more responses were posted
Re: having fun with the HP17b  Gerson W. Barbosa  06072011
Quote:
7? (100 LN 2 LN /)
Re: having fun with the HP17b  Don Shepherd  06072011 yup!
Re: having fun with the HP17b  Gerson W. Barbosa  06072011 Implementing the TI 58/59 game described below on an RPN HP calculator is trivial. Now doing it on the HP17B is not. Congratulations!
From the TI Programmable 58/59 Master Library Manual, page 77: HILO GAME ML21 Re: having fun with the HP17b  Don Shepherd  06072011 The 17b solver is not the best platform for this particular game, I just wanted to see if it could be done in a way that wasn't too horrible. It is more intuitive on a regular RPN calculator; for example, you enter your guess and press R/S and it immediately tells you "too high" or "too low" (on models like the 30b that have alpha messages). The 17b requires another keypress to get that feedback.
I like to discuss this problem with my students. They are always kind of amazed that a maximum of only 7 guesses can identify a selected number from 0 to 99 when I show them the advantages of splitting the groups in half each time, thus narrowing down the potential set of numbers. It kind of makes math interesting, if only for a moment!
HiLo Game with an interesting twist  Namir  06072011 I have used the hilow guessing games in many programmings books that I wrote way back. I would present various versions, each a bit more sophisticated than the previous one. One interesting (and cunning) variation of the hilow game is the percent of reliability for the feedback. Normally, the program would reliably tell you if your guess is higher or lower than the secret number. This special variant would introduce a level of doubt (say 10%) in that kind of answer, making thinks a bit more interesting. Namir
Edited: 7 June 2011, 7:49 p.m.
Re: HiLo Game with an interesting twist  Gene Wright  06072011 I think "Jive Turkey" was the name the TI user group put on that variety of HiLo game.
Re: having fun with the HP17b  Gerson W. Barbosa  06072011
Quote:
In the example at the next page in the TI manual the program is asked to find a secret number, 848. The program's guesses, following the user's correct clues, are 512, 768, 896, 832, 864 and 848, that is, 512, 512+256, 512+256+128, 512+256+12864, 512+256+12864+32 and 512+256+1286416. That's the principle behind the binary search algorithm. Once I used this technique to find a fault in an 800meter long circuit in four or five steps. The idea occurred to me from having played this little game. Thanks for bringing it back :)
Re: HiLo Game with an interesting twist  Gerson W. Barbosa  06072011
Quote: Namir, Would you mind posting a couple of listings here? Thanks!
Gerson.
Re: HiLo Game with an interesting twist  Namir  06072011 Here is a QBasic listing (also runs on 64bit QB64):
REM HiLO GUESSING GAME
Edited: 8 June 2011, 12:22 a.m. after one or more responses were posted
Re: HiLo Game with an interesting twist  Gerson W. Barbosa  06072011 Runs nicely! Thank you!
Re: having fun with the HP17b  Don Shepherd  06082011 Well, a little testing with VBScript has determined that the method I used to generate a random number between 0 and 99 is totally unacceptable. Whole series of numbers, such as 14, 1215, 2326, etc., are never generated by that method. So I came up with a new method using the first 2 digits of the fractional part of the square root of mmss returned by the CTIME function, and that method does generate every number from 0 to 99 in a more or less random method, good enough for an entertainment program. This is the new program:
Re: having fun with the HP17b  Marcus von Cube, Germany  06102011 The 20b SDK by Cyrille and Tim is designed just around this game. :)
