Post Reply 
Hi-Low Game with a twist
12-20-2023, 04:31 AM (This post was last modified: 12-21-2023 02:10 PM by Namir.)
Post: #1
Hi-Low Game with a twist
This is a version of the Hi-Low guessing game that has the following features:

1. You guess a secret number between 1 and 1000.
2. You have up to ten guesses to get it right!
3. You select the level of reliability for the LO/HI hints that guide your next guess. A value of 100 (percent) makes the program always tell the truth about the Hi?LO hints. A value of 0 (percent) makes the program always lie about the Hi?LO hints. A value of 50 (percent) makes the program tell the turh an expected 50% of the time about the Hi?LO hints. I sugges values like 95 or 90.

You can download the .raw file by clicking here.

To play the game:

1. Load the program.
2. Turn on the User mode.
3. Press the [A] key. The program display "SEED?"
4. Enter a seed value (>0 and <1) and press [R/S].
5. The program displays "%RELY".
6. Enter the reliability level for the hints in percent. Press [R/S].
7. The program display "GUESS?".
8. Enter a guess value and press [R/S].
9. If you did not guess the secret number, the program displays HI or LO hints to guide your next guess (and may lie to you). Press the [R/S] key.
10. Go to step 7.
11. If you guess the secret numbers within 10 attempts, the program displays "SUCCESS". Press [R/S] and the program displays the number of iterations that lead you to the correct answer.
12. If you failed to guess the secret numbers within 10 attempts, the program displays "SN IS " followed by the secret numer.
13. You can play again by either going back to step 3, or simply by pressing key [B] (to skip the prompts for the seed and % reliability) and go to step 7.


Code:
01 LBL "HILO"
02 LBL A
03 "SEED?"
04 PROMPT
05 1
06 X=Y?
07 LOG
08 FRC
09 X=0?
10 PI
11 STO 00
12 "%RELY?"
13 PROMPT
14 1E2
15 /
16 STO 03
17 LBL B
18 FIX 00
19 XEQ E
20 1E3
21 *
22 INT
23 1
24 +
25 STO 01
26 CLX
27 STO 02
28 "1 TO 1000"
29 PROMPT
30 LBL 00
31 1
32 STO+ 02
33 11
34 RCL 02
35 X>Y?
36 GTO 03
37 "GUESS?"
38 PROMPT
39 INT
40 RCL 01
41 X<>Y
42 X=Y?
43 GTO 02
44 X>Y?
45 GTO 01
46 XEQ E
47 RCL 03
48 "HI"
49 X>Y?
50 "LO"
51 PROMPT
52 GTO 00
53 LBL 01
54 XEQ E
55 RCL 03
56 "LO"
57 X>Y?
58 "HI"
59 PROMPT
60 GTO 00
61 LBL 02
62 "SUCCESS"
63 BEEP
64 PROMPT
65 "ITRS="
66 ARCL 02
67 FIX 05
68 PROMPT
69 GTO B
70 LBL 03
71 TONE 9
72 "SN IS "
73 ARCL 01
74 FIX 05
75 PROMPT
76 GTO B
77 LBL E
78 997
79 RCL 00
80 *
81 FRC
82 STO 00
83 RTN
Find all posts by this user
Quote this message in a reply
12-21-2023, 04:14 AM
Post: #2
RE: Hi-Low Game with a twist
Sounds like the "Jive Turkey" approach to the game. :-)
Find all posts by this user
Quote this message in a reply
12-21-2023, 05:24 AM
Post: #3
RE: Hi-Low Game with a twist
.
Hi,

As he frequently does (despite my usual advice), Namir does not include a sample run, which would seem necessary to ascertain that the program is correctly loaded and runs as intended.

He also doesn't explain how does the % Reliability parameter affect the game:
    - Does a 100% mean that the program never lies ?

    - Does a 0% mean that the program always lies (which would be tantamount to it never lying, you'd just consider the opposite of what it says) ?

    - Does a 50% mean that it lies with a 0.5 probability ?
And so on. Also, as the secret numbers are spread between 1 and 1000, you might need as many as 10 tries even if using the best binary strategy and even if the program never lies to you. Any significant amount of lying and more than 10 guesses might be necessary no matter how good your strategy, which is unfair as you can't win in a deterministic way, you'd depend on sheer luck.

V.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
12-21-2023, 02:08 PM (This post was last modified: 12-21-2023 02:12 PM by Namir.)
Post: #4
RE: Hi-Low Game with a twist
- Does a 100% mean that the program never lies ?

- Does a 0% mean that the program always lies (which would be tantamount to it never lying, you'd just consider the opposite of what it says) ?

- Does a 50% mean that it lies with a 0.5 probability ?

Yes to all of the above!

I added an explanation about the reliility. This feature has existed for several decades in various computer languages (books and articles). I have no reference to any of these for the time being.

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




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