Post Reply 
(12C) Hi-Lo Game
08-06-2023, 03:13 PM (This post was last modified: 08-07-2023 10:34 PM by Peet.)
Post: #1
(12C) Hi-Lo Game
Hi-Lo game, guess a number between 2 and 999 - usage: <NUMBER> R/S

Start with R/S - Diplay: 0
<guess> R/S - Diplay: -1 (guess to low), 1 (to high) or Number of attempts if guess was right

Code:

01 RCL 0           RAND / in advance save a seed between 0 and 1 to STO 0
02 9
03 LN
04 +
05 5
06 Y^X
07 FRAC            "random" number between 0 and 1
08 STO 0           save as new seed to STO 0
09 9
10 9
11 8
12 *
13 INTG
14 2
15 +               choose a number between 2-999 (because infos are -1/0/1)
16 STO 1           number to guess
17 CLX
18 STO 2           set counter to 0
19 R/S             <input>
20 1
21 STO + 2         increase counter
22 R down          input to x
23 RCL 1
24 -
25 x=0             0: guess is right
26 GTO 33          GOTO <OK>
27 ENTER
28 ENTER
29 *
30 SQRT            SQR / SQRT -> ABS(x)
31 /               -1: Assumption to low / +1: guessed to high
32 GTO 19          GOTO <input> - new guess
33 RCL 2           <OK> (show the number of attempts)
34 GTO 00

Note: the platinum requires 3 digits for the goto, i.e. gto 033 instead of gto 33

My calculators - former: CBM PR100, HP41CV, HP11C, HP28S - current: HP48G, HP35S, Prime, DM41X, DM42, HP12C
Find all posts by this user
Quote this message in a reply
12-06-2023, 05:40 AM
Post: #2
RE: (12C) Hi-Lo Game
Very interesting program for a Hi-Lo Game especially for the HP-12C

Thank for this great program again and I try it already with my best guest count for 9 times.

Gamo
Find all posts by this user
Quote this message in a reply
12-06-2023, 08:53 PM
Post: #3
RE: (12C) Hi-Lo Game
Wow, this game fits the last 34 lines on my 12C, starting at line 65.

Now the program memory is full Smile

HP-12C Gold / HP-12C Platinum
Find all posts by this user
Quote this message in a reply
Post Reply 




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