Post Reply 
(11C) "Hi-Lo" Game
01-15-2018, 06:16 PM (This post was last modified: 01-15-2018 08:24 PM by Dieter.)
Post: #2
RE: (11C) "Hi-Lo" Game
(01-15-2018 01:11 PM)Gamo Wrote:  This Hi-Lo program randomly pick numbers between 1 and 100
...
Enter number the display read "Hi" or "Lo" when look inverted.

There are several issues with this program:

- The program does not generate a number between 1 and 100, but between 0 and 99.
- If you turn the display upside down it does not read "hi" and "Lo" but "00hI" and "LOO"
- The guess counter in R5 is not initialized. It is reset to zero after the game instead of at the beginning.
- Most important: the program evaluates the first guess incorrectly. The first hint given by the program compares the user input not with the hidden number but with 14.

This is because the hidden number is assumed to be on the stack, but on the first run it isn't. Try it: Start the program and enter 14 as your first guess. The program will say that this is the correct number.

You generally should not carry the secret number on the stack. If the user presses only one additional key the whole stack is disturbed any everything will go wrong. But you don't have to do this – the number is stored in R1, so there is no need at all to keep it on the stack.

BTW, I like this idea of displaying hI and LO with the numbers 14 and 07. This reminds me of other early calculator games where messages had to be read upside down – remember the Nim program in the 34C manual which displayed 55178 ("bliss") or 3507.1 ("I lose") ? But what about displaying this in the two exponent digits?

3.       07    => 3. guess is LO
4.       14    => 4. guess is HI

And what about a counter? You lose if you haven't made it in 8 guesses. ;-)

Finally, on the 15C there is an easy way to get a flashing display: simply cause an overflow. Maybe you can also test this on the 11C – I'm not sure if it works the same way. If it does, EEX 2 10^x RCL 5 may be used to show the number of guesses with a flashing display.

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(11C) "Hi-Lo" Game - Gamo - 01-15-2018, 01:11 PM
RE: (11C) "Hi-Lo" Game - Dieter - 01-15-2018 06:16 PM
RE: (11C) "Hi-Lo" Game - Gerson W. Barbosa - 01-16-2018, 01:54 AM
RE: (11C) "Hi-Lo" Game - Dieter - 01-16-2018, 08:25 AM
RE: (11C) "Hi-Lo" Game - Gerson W. Barbosa - 01-16-2018, 08:35 PM
RE: (11C) "Hi-Lo" Game - Dieter - 01-17-2018, 08:15 PM
RE: (11C) "Hi-Lo" Game - Gerson W. Barbosa - 01-17-2018, 11:39 PM
RE: (11C) "Hi-Lo" Game - Dieter - 01-18-2018, 08:18 AM
RE: (11C) "Hi-Lo" Game - Gamo - 01-18-2018, 01:25 AM



User(s) browsing this thread: 1 Guest(s)