Post Reply 
HHC 2021 Programming Contests - Surprise !
10-18-2021, 05:42 PM
Post: #35
RE: HHC 2021 Programming Contests - Surprise !
(10-06-2021 05:35 PM)Werner Wrote:  Just finished my RPN program using the exact same algorithm Dave just explained ;-)
It doesn't use any synthetics or CX commands. The listing is in 42S code, the corresponding 41 code is 88 bytes without the END. Stack-only, of course ;-)
There's probably room for improvement..

Hi Werner,
Being an RPN implementation of Dave's method, I was curious about how you did it in fewer steps and bytes than my effort. Of course doing it stack-only helps, eliminating byte- and step-wasting stores and recalls. I'm lazy and usually just store and recall things in registers. (After I get a working program, sometimes I go back and actually see where things go in the stack and try to devise ways to eliminate the use of registers, but have not (yet) done so with my program.) I have not fully dissected your program, but upon loading and running, I did notice that it seems to fail on the "all nine(s)" cases, e.g., entering 9 should yield 11, 99 should give 101, etc. Unless I mis-entered your program, it gives 101 for 9, 1001 for 99, etc. I'm in no way criticizing your effort, your code for these challenges always strike me as marvels of efficiency and cleverness. I assume you simply did not consider these cases. I found them kind of annoying, and handling them was the last thing I added to mine after getting the basic routine to work. I'd be interested in seeing your approach to handling all nine(s) if you care to spend any more time on this problem, which I will understand if you do not.
Jeff

Dave - My mind is going - I can feel it.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HHC 2021 Programming Contests - Surprise ! - Jeff O. - 10-18-2021 05:42 PM



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