HHC 2017 RPN Programming contest information and results thread
|
09-18-2017, 06:00 AM
Post: #21
|
|||
|
|||
RE: HHC 2017 RPN Programming contest information and results thread
Dave: if you replace
RDN 1 by SIGN you're down to 69. Congrats! Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
09-18-2017, 07:51 AM
Post: #22
|
|||
|
|||
RE: HHC 2017 RPN Programming contest information and results thread
I've been able to get it down to 68 bytes, Dave's idea
Code: >LBL"HAPPY" Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
09-18-2017, 08:23 AM
Post: #23
|
|||
|
|||
RE: HHC 2017 RPN Programming contest information and results thread
Just wondering if a CLSTK at the end is shorter than the '0' at step 5?
Default state at the start means zeros on the stack but to be rerunnable these have to be restored. Pauli |
|||
09-18-2017, 09:03 AM
Post: #24
|
|||
|
|||
RE: HHC 2017 RPN Programming contest information and results thread
No, 0 and CLST are both 1 byte on a 41.
Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
09-18-2017, 11:02 AM
(This post was last modified: 09-18-2017 11:03 AM by Didier Lachieze.)
Post: #25
|
|||
|
|||
RE: HHC 2017 RPN Programming contest information and results thread
(09-18-2017 07:51 AM)Werner Wrote: I've been able to get it down to 68 bytes, Dave's idea Excellent! but there are too much labels. We can save one byte by removing LBL 01 , going down to 67 bytes: Code: Step Bytes Instruction |
|||
09-18-2017, 11:26 AM
Post: #26
|
|||
|
|||
RE: HHC 2017 RPN Programming contest information and results thread
You Shall Not Pass!
66 bytes Code: >LBL"HAPPY" Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
09-18-2017, 11:39 AM
Post: #27
|
|||
|
|||
RE: HHC 2017 RPN Programming contest information and results thread
Ah, I KNEW there had to be a way to improve the 4/1 tests somehow. Didn't think to use SIGN and indirect GTO. Very nice.
|
|||
09-18-2017, 08:04 PM
Post: #28
|
|||
|
|||
RE: HHC 2017 RPN Programming contest information and results thread
Some of the below is repeated in the post for the RPL programming contest...
-------------------------------------------------------------------------------------------- The way the contests work at a real HHC gathering goes something like this. 1) We announce that program submissions (a physical machine with the program in it already AND a printed/hand written listing of the program AND the author's name on the machine and listing) are due to the judge at say Noon. 2) Noon happens to be when we break for lunch. 3) So as we break for lunch, those entering the contest are fighting their way to the judge who has to be careful to keep the machines safe (I dropped a 41C two years ago and broke it - ugh - didn't enjoy getting that fixed). 4) The judge tries to go get some lunch and then runs the inputs to the RPL and RPN contests on the machines and tries to record results / score them. 5) This is often a slow process since people want to be friendly and are curious. Personally, I don't like to hide, but I probably should. 6) The contest results are usually determined in an hour or so and then announced around 3pm. The results are kept secret until then. 7) Winner of each contest gets to pick a prize from the prize table AFTER the Best Speaker picks one but before all the other attendees will pick one. 8) The judge then starts trying to think of a contest for next year! -------------------------------------------------------------------------------------------- Here are the numbers I used as test inputs. Number 1: 123,456,789 Result: UNHAPPY 13 Number 2: 987,654,321 Result: UNHAPPY 13 Number 3: 555,555,555 Result: UNHAPPY 12 Number 4: 20 Result: UNHAPPY 1 Number 5: 989 Result: HAPPY 6 Number 6: 13 Result: HAPPY 2 Number 7: 15999 Result: UNHAPPY 16 (Note: 16 is the highest number of cycles required for a 10 digit or less number to process. Thanks, Eric Smith for finding this!) Number 8: 100 Result: HAPPY 1 Number 9: 8002 Result: HAPPY 3 Number 10: 1 Result: HAPPY 1 |
|||
09-18-2017, 09:23 PM
(This post was last modified: 09-19-2017 04:34 PM by Don Shepherd.)
Post: #29
|
|||
|
|||
RE: HHC 2017 RPN Programming contest information and results thread
Never having used a 41, I wanted to implement the problem using the 17bii solver. Here is the equation:
Code: HAPPY:HAP+CYC+ This is not a normal solver equation, it takes advantage of the fact you can exit a loop by inducing an error in the calculation (divide by 0 works well) after saving whatever values you want in variables that you can then RCL. So, to run this, enter your desired number to test and press NUM. Then press ANS (solve for ANS). After a few seconds it will beep and display SOLUTION NOT FOUND. Just RCL HAP (4=unhappy, 1=happy) and RCL CYC for the number of cycles. |
|||
09-18-2017, 10:26 PM
(This post was last modified: 09-18-2017 11:07 PM by John Keith.)
Post: #30
|
|||
|
|||
RE: HHC 2017 RPN Programming contest information and results thread
OK then, here's my (irrelevant) RPL version using DavidM's ListExt library:
Code: \<< 0 SWAP DO I\->NL SQ LSUM SWAP 1 + SWAP |
|||
09-18-2017, 10:36 PM
Post: #31
|
|||
|
|||
RE: HHC 2017 RPN Programming contest information and results thread | |||
09-19-2017, 04:01 AM
Post: #32
|
|||
|
|||
RE: HHC 2017 RPN Programming contest information and results thread
Good catch, of course CLA requires only 1 byte instead of 2 and on step 4 FIX 0 requires 2 bytes and not 1. It seems I swapped the byte count for these two instructions, but the total count is right.
I can't find any further optimization of Werner's last code. The GTO IND is brilliant ! |
|||
09-19-2017, 05:57 AM
Post: #33
|
|||
|
|||
RE: HHC 2017 RPN Programming contest information and results thread
Well, I missed all big improvements (ATOX, the 1/4 combined test), all I did was find two tricks ;-)
Now, what should 1 HAPPY return? "HAPPY 1" or "HAPPY 0"? I vote for the latter. It's logical that 1 HAPPY is "HAPPY 0" and 10 HAPPY is "HAPPY 1". Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
09-19-2017, 09:53 AM
Post: #34
|
|||
|
|||
RE: HHC 2017 RPN Programming contest information and results thread
Here is my version. It uses synthetic programming. It restores the flags and settings to its previous state and uses register 'a' as counter for the (un-)happy steps.
71 Bytes, no regs. Regards Bernd Code:
|
|||
09-19-2017, 12:14 PM
Post: #35
|
|||
|
|||
RE: HHC 2017 RPN Programming contest information and results thread
(09-19-2017 05:57 AM)Werner Wrote: Well, I missed all big improvements (ATOX, the 1/4 combined test), all I did was find two tricks ;-) Hello all! The powers of the on-site judge are nearly all-inclusive. Per the rules I wrote :-) which say this: "Start with a number and replace it with the sum of the squares of each of its digits. Compare the computed sum of these squares to the rules below. Repeat the process with the previous result as the next input." 1 should return HAPPY 1. Start with a number - in this case 1 is entered. Then replace it with the sum of the squares of each of its digits. Ok, still 1. THEN compare the computed sum to the rules below. At this point, one cycle has occurred so when 1 is evaluated, the cycle count should be 1. Same score as 10 or 100 etc. of course. :-) |
|||
09-19-2017, 01:05 PM
(This post was last modified: 09-19-2017 02:23 PM by Werner.)
Post: #36
|
|||
|
|||
RE: HHC 2017 RPN Programming contest information and results thread
I bow to the judge..
[Edited] Still 66 bytes Code: >LBL"HAPPY" 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
09-19-2017, 03:05 PM
(This post was last modified: 09-19-2017 03:06 PM by DanM.)
Post: #37
|
|||
|
|||
RE: HHC 2017 RPN Programming contest information and results thread | |||
09-19-2017, 03:18 PM
Post: #38
|
|||
|
|||
RE: HHC 2017 RPN Programming contest information and results thread | |||
09-19-2017, 09:02 PM
Post: #39
|
|||
|
|||
RE: HHC 2017 RPN Programming contest information and results thread
Here is another 66 byte version that uses Werner's clever trick of 4/1 check. It works on a HP 41C, but uses synthetic commands.
Regards Bernd Code: LBL "HAPPY" |
|||
09-19-2017, 09:05 PM
Post: #40
|
|||
|
|||
RE: HHC 2017 RPN Programming contest information and results thread
(09-19-2017 03:05 PM)DanM Wrote: For the conference, my notes indicate that Gene said 10 entries for the RPN contest and only 5 for the RPL. I find that ratio interesting.Those are high numbers for both contests if my memory serves. There are usually more entries for the RPN contest than the RPL one. IN 2016 there were only 4 RPL entries. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 7 Guest(s)