|HHC 2012 RPN Programming Challenge Conundrum |
Message #1 Posted by Jeff O. on 3 Oct 2012, 7:59 p.m.
I enjoy the HHC programming challenges, usually tackling after the fact. For personal satisfaction, I try to develop my best solution before looking at the Museum Forum discussion. I cogitated a little over the weekend of 22-23 September regarding this year's problem, but did not really start trying to write anything until Tuesday the 25th, and relatively quickly had a working routine (all routines on a wp34s.) Of course I kept up my normal Forum review, not reading any posts that had "HHC Programming Challenge" in the subject line. But I could see the subject lines, and saw that one mentioned something about a "12 Step Nashville Solution." 12 steps!!? Crap, my first attempt was 38 steps. OK, the first attempt was just to get a working program, I was sure it could be optimized, but 26 steps worth of optimization seemed unlikely. Long story short, I finally got down to 14 steps before writing this message. In the past, I would probably have been satisfied with going from 38 steps down to 14, but since I know there is a 12 step solution, it is difficult to stop. I'm doubtful I can shave it down to 12 using the solution approach I have chosen. I suspect there is some fundamental simplification to the solution that I am not going to see. So, if you have read this far, here is the conundrum. Should I:
1. Give up, read all of the Forum posts and be ready to slap my forehead when I see the obvious simplification I've been missing.
2. Give up, don't read the discussion and just try to be satisfied with my 14 step using-registers and 16 step all-stack programs.
3. Don't read the posts and keep on plugging away.
update - I followed option 3 and got down to 12 steps. Then followed option 1. With some insights gained, was able to write a 10 step program to solve the challenge.
Edited: 16 Oct 2012, 10:43 a.m. after one or more responses were posted