The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

HHC / HP Museum Programming Contest for RPN and RPL machines
Message #1 Posted by gene wright on 21 Sept 2013, 10:41 a.m.

The RPN contest write-up:

RPN

The RPL contest write-up:

RPL

Important Rules...

Do not post any solutions to the forum until at least 6pm Sunday Denver (Mountain USA) time.

Please be careful about **questions** you post here about the contest too. Some questions in the past have actually given away how to solve the problem. Keep your cards close to your chest.

Questions? Email me at

gene

wright

143

at

hotmail

dot

com

      
Re: HHC / HP Museum Programming Contest for RPN and RPL machines
Message #2 Posted by Pier Aiello on 21 Sept 2013, 11:04 a.m.,
in response to message #1 by gene wright

Could i load these on wiki4hp ?

edit: for now i guess "yes", if it is the contrary, just tell me i'll remove the pdfs from wiki4hp.

Edited: 21 Sept 2013, 11:36 a.m.

            
UPDATE RPL change ...Re: HHC / HP Museum Programming Contest for RPN and RPL machines
Message #3 Posted by gene wright on 21 Sept 2013, 11:53 a.m.,
in response to message #2 by Pier Aiello

No base 16 for the RPL contest. ONLY bases 2, 8 and 10 entered as real numbers.

Sorry about that.

                  
Re: UPDATE RPL change ...Re: HHC / HP Museum Programming Contest for RPN and RPL machines
Message #4 Posted by Eric Smith on 22 Sept 2013, 2:07 a.m.,
in response to message #3 by gene wright

There was another rules clarification at the conference that no base conversion functions can be used. I think that might eliminate a few of the shortest entries that have been described here, but of course I haven't seen them so I don't really know.

My RPN entry is currently 19 steps on WP-34S or HP-42S, and probably the same for the 15C but I haven't thought about that much. I need two more steps on the HP-41C. I'm too tired now to figure out how to time it.

148 bytes (not counting global name) for my RPL entry on the 50g. It was 153.5 bytes until I realized that one of my clever optimizations actually made it longer.

                        
Re: UPDATE RPL change ...Re: HHC / HP Museum Programming Contest for RPN and RPL machines
Message #5 Posted by Gerson W. Barbosa on 22 Sept 2013, 2:28 p.m.,
in response to message #4 by Eric Smith

Quote:
My RPN entry is currently 19 steps on WP-34S

Same here, but I'm using wp34s specific instructions, so probably more on the 42s. I didn't even try the 12C or 33C (perhaps I'd need 5 or 6 more instructions on those).

                              
Re: UPDATE RPL change ...Re: HHC / HP Museum Programming Contest for RPN and RPL machines
Message #6 Posted by Gerson W. Barbosa on 22 Sept 2013, 3:52 p.m.,
in response to message #5 by Gerson W. Barbosa

Update: I decided to use only the stack. As a result, 18 steps now. Perhaps more saving is possible, but I have to leave.

0.11037552421  -->  0.14159265358

Edited: 22 Sept 2013, 4:02 p.m.

      
Re: HHC / HP Museum Programming Contest for RPN and RPL machines
Message #7 Posted by Pal G. on 21 Sept 2013, 2:55 p.m.,
in response to message #1 by gene wright

Gene, thanks for including those of us who could not make the trek. Thanks for doing it each year.

      
Re: HHC / HP Museum Programming Contest for RPN and RPL machines
Message #8 Posted by Gerson W. Barbosa on 21 Sept 2013, 3:33 p.m.,
in response to message #1 by gene wright

RPN, HP-15C, 19 steps, first version:

         0.5 R/S  -->  0.625         ( 2.4 s)
        0.75 R/S  -->  0.953125      ( 3.6 s)
 0.777777777 R/S  -->  0.999999993   (12.2 s)
Impossible to time, but it shouldn't take longer than 0.1 s on the HP-15C LE.

Gerson.

P.S.: Rounding error in the last example (correct result: 0.999999994)

Edited: 21 Sept 2013, 3:45 p.m.

            
Re: HHC / HP Museum Programming Contest for RPN and RPL machines
Message #9 Posted by Egan Ford on 21 Sept 2013, 5:08 p.m.,
in response to message #8 by Gerson W. Barbosa

Quote:
RPN, HP-15C, 19 steps, first version:
My HP-12C (circa 1981) RPN version is also 19 steps:
         0.5 R/S  -->  0.625         ( 2.3 s)
        0.75 R/S  -->  0.953125      ( 3.0 s)
 0.777777777 R/S  -->  0.999999993   ( 9.9 s)

Update: 18 steps.

Edited: 21 Sept 2013, 5:37 p.m.

                  
Re: HHC / HP Museum Programming Contest for RPN and RPL machines
Message #10 Posted by Gerson W. Barbosa on 21 Sept 2013, 5:48 p.m.,
in response to message #9 by Egan Ford

Thanks for sharing your results!
Now 17 steps here and 11.6 seconds for the last example. I haven't tried the HP-12C yet, but I think I would need at least a couple more steps on it.

Gerson.

Edited: 21 Sept 2013, 5:50 p.m.

                        
Re: HHC / HP Museum Programming Contest for RPN and RPL machines
Message #11 Posted by Egan Ford on 21 Sept 2013, 5:57 p.m.,
in response to message #10 by Gerson W. Barbosa

Right now my 12C version only supports 0 <= x < 1. Rules state that 1 is included. So I may need a few more steps. 21 steps for 0 <= x <= 1.

                              
Re: HHC / HP Museum Programming Contest for RPN and RPL machines
Message #12 Posted by Gerson W. Barbosa on 21 Sept 2013, 6:00 p.m.,
in response to message #11 by Egan Ford

Same here. I overread the part that says "Each test case will consist of a value in octal between 0 and 1, inclusive."

                              
Re: HHC / HP Museum Programming Contest for RPN and RPL machines
Message #13 Posted by Gerson W. Barbosa on 21 Sept 2013, 6:39 p.m.,
in response to message #11 by Egan Ford

20 steps for 0 <= x <= 1. Costing me 3 extra steps as well.

                                    
Keep going all... FYI - I developed my version that runs on an HP 65
Message #14 Posted by gene wright on 21 Sept 2013, 6:51 p.m.,
in response to message #13 by Gerson W. Barbosa

39 steps, unfortunately for several reasons...

unmerged steps

bad programming

:-)

                                          
Re: Keep going all... FYI - I developed my version that runs on an HP 65
Message #15 Posted by Gerson W. Barbosa on 21 Sept 2013, 10:11 p.m.,
in response to message #14 by gene wright

Mostly due to lack of merged steps, of course! Still 20 steps, perhaps I should try the HP-33C when I find the charger :-)
Thanks for the interesting programming problems.
A nice conference to you all!

Gerson.

      
Re: HHC / HP Museum Programming Contest for RPN and RPL machines
Message #16 Posted by Mark Storkamp on 21 Sept 2013, 9:20 p.m.,
in response to message #1 by gene wright

RPN, HP-41CX, 19 steps

          0 R/S --> 0           (0.39s)
        0.7 R/S --> 0.875       (0.81s)
       0.75 R/S --> 0.953125    (1.21s)
0.777777777 R/S --> 0.999999993 (4.09s)
          1 R/S --> 1           (0.40s)

Timing done with the internal stopwatch. (I didn't count those lines in the total number of steps)
I'm now down to 5 steps, and the timing is 0.66s, 0.67s, 0.67s, 0.75s, and 0.70s

Now that rule number 4 which stated "Any already existing functionality in the machine is ok" has been changed, I'm back to 19 steps. I'll wait for the comprehensive list of allowed functions before I try and improve on what I've got. Is storage register arithmetic allowed on the stack? That might improve things, but not every calculator can do that.

Edited: 22 Sept 2013, 7:22 a.m. after one or more responses were posted

            
Re: HHC / HP Museum Programming Contest for RPN and RPL machines
Message #17 Posted by Gerson W. Barbosa on 22 Sept 2013, 12:11 a.m.,
in response to message #16 by Mark Storkamp

Quote:
I'm now down to 5 steps, and the timing is 0.66s, 0.67s, 0.67s, 0.75s, and 0.70s

14 steps. Sounds great! Looking forward to seeing your solution (when the time is right, of course).

Just for fun:

HP-15C

7777777777 R/S --> 1073741823 (15.3s) 1234567 R/S --> 342391 (11.4s) 7654.321 R/S --> 4012.408203 (11.4s) 0 R/S --> 0 ( 0.8s) 0.7 R/S --> 0.875 ( 3.9s) 0.75 R/S --> 0.953125 ( 5.1s) 0.777777777 R/S --> 0.999999993 (13.9s) 1 R/S --> 1 ( 4.0s)


32 steps, however.

Gerson.

Edited: 22 Sept 2013, 12:14 a.m.

            
Re: HHC / HP Museum Programming Contest for RPN and RPL machines
Message #18 Posted by Olivier De Smet on 22 Sept 2013, 2:22 a.m.,
in response to message #16 by Mark Storkamp

HP41 : 7 steps with label and END :) (should be the same as Mark)

Not timed but very quick :)

Convert as 20 steps for an HP65 with label and RTN (some peculiarities adds 2 steps)

Edited: 22 Sept 2013, 2:36 a.m.

      
Re: HHC / HP Museum Programming Contest for RPN and RPL machines
Message #19 Posted by Miguel Toro on 22 Sept 2013, 9:39 a.m.,
in response to message #1 by gene wright

Hi,

WP 34S, 19 steps without labels. Very fast but no actual times, though.

Thank you for the challenge.

Miguel


[ Return to Index | Top of Index ]

Go back to the main exhibit hall