The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





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
Post Reply 


Messages In This Thread
(12C) Hi-Lo Game - Peet - 08-06-2023 03:13 PM
RE: (12C) Hi-Lo Game - Gamo - 12-06-2023, 05:40 AM
RE: (12C) Hi-Lo Game - lvt - 12-06-2023, 08:53 PM



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