Post Reply 
[VA] HP-71B Mini-challenge: Qualifying for a job
09-16-2022, 06:10 AM (This post was last modified: 09-16-2022 06:34 AM by C.Ret.)
Post: #14
RE: [VA] HP-71B Mini-challenge: Qualifying for a job
(09-15-2022 12:21 PM)J-F Garnier Wrote:  Now that you disclosed a lot, it may be time to post our best (valid) solutions. I will do tomorrow.

The problem is that even my most successful version isn't quite perfectly valid. As I announced previously, it is 89 bytes (without line 10) and I would have needed a few more to correct a last and the very slight but undeniable pitfalls, which I leave these to you to discover by analyzing my most (valid) code:


>CAT                   -> workfile   BASIC      89   09/15/22 15:21
>LIST                   -> 1 DEF FNO=1 @ DEF FNZ=0 @ DEF FND=CEIL(6*RND) @ DEF FNG=FNS(8)-4 @ DEF FNS(N) @ IF INT(N) THEN FNS=RND+FNS(N-1)
                      -> 2 END DEF

                      -> 10 DISP TIME$ @ PAUSE



Line 1 cannot be edited directly because it is too long. To enter it, you must type the instructions without separating spaces, ie without using the preprogrammed key on the keyboard.

I colored in light blue the omissions of the faulty 75-byte version and the test-program line 10. The faults of this inadmissible version are effectively demonstrated by adding a beginning of the program serving as a test. We then realize that the calls to FNZ and FNS(n) display the time before returning any result because the instruction indicating the end of the definition is missing.

Nevertheless, these two lines are very interesting, and I greatly thank Valentin for this formidable challenge which is an opportunity to show the power of the HP-71B and its BASIC.

Indeed, in two lines appear the different types of user-function definitions;
  • with or without '=' sign,
  • in one or more lines,
  • a definition using another user function (which can be placed before the second),
  • a definition by recurrence,
  • ...

Many of these programmatic aspects are not allowed on other less powerful BASIC or other programming languages ​​(FORTH, PASCAL, ...) Not to mention runtime efficiency both for speed and memory consumption that results.

The downside of these optimizations is the regretful limitation in the names of variables deemed too short. But it's infinitely better than having only numbered and anonymous registers and so much faster than other BASICs allowing phantasmagorical and useless names of 32 characters!
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] HP-71B Mini-challenge: Qualifying for a job - C.Ret - 09-16-2022 06:10 AM



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