Post Reply 
My 1st HP-41 program. Suggestions?
10-19-2023, 03:53 AM
Post: #4
RE: My 1st HP-41 program. Suggestions?
(10-19-2023 12:49 AM)Jeff_Birt Wrote:  My 1st HP-41 program. Suggestions?

There are a number of optimizations which could be made but for a first program it's quite acceptable. The largest optimization would be this:

The 15 lines in your original code highlighted in bold red below:
    [...]
    "Guess 1-10"
    PROMPT ; Type in # then press R/S
    X=Y?
    GTO 03 ; Correct guess handler
    X>Y?
    GTO 02 ; X>Y handler
    "TOO SMALL" ; **X<Y handler
    AVIEW
    PSE
    PSE
    RDROP ; Keep Rand # in Y
    GTO 01
    LBL 02 ; **X>Y handler
    "TOO BIG"
    AVIEW
    PSE
    PSE
    RDROP ; Keep Rand # in Y
    GTO 01

    LBL 03 ; **Correct handler
    [...]

... can be replaced by these 8 lines below:
    "TOO SMALL"
    X>Y?
    "TOO BIG"
    AVIEW
    PSE
    PSE
    RDROP
    GTO 01

for a net savings of 7 lines of code.

Hope it helps.
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
Post Reply 


Messages In This Thread
RE: My 1st HP-41 program. Suggestions? - Valentin Albillo - 10-19-2023 03:53 AM



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