HCC2007 programming contest on 17bii



#2

OK, I know the HCC2007 programming contest was for the new 35C, but I couldn't resist trying it on the 17bii and 17bii+ solvers. The timings for the 4 numbers (9971892227, 7654321, 1234567891, and 1234554321) were: 25 seconds on the 17bii, and 54 seconds on the 17bii+ (newer isn't always better!).

The code is here. I first scanned the input number and incremented variables A-I with the number of 1's through 9's, then I went through the 9 variables and constructed the output number.

The code works on both the 17bii and 17bii+.


#3

Now, this is challenging!!

Very interesting. The expression "hats off" comes to my mind, as a congratulation. If, for any idiomatic twist, it is not appropriate, please disregard.


#4

Thank you, Andres. I liked your solution for the 35s also. I submitted an entry at HCC in San Diego, but I'm afraid I was not in the same league as the winner (I think my timing was about 58 seconds for the 4 numbers) :(

I really admire HP for creating products like the 35s and the 17bii. And especially since products like the 17bii allow you to program devices that generally are not considered programmable.


#5

Could we know what the contest actually was at HCC2007?

I have a HP17BII+ and a HP35S and I must admit I prefer programming the HP17BII+ as the code produced seems more meaningful with the ability to use proper variable names.

Is there a name for the programming language used on the HP17BII+? It is neither RPN or RPL and very simple with Let, Get, Sum and IF which are the basic tools for a programming language. It would be nice to be able to use subroutines i.e. to be able to use sine and cosine equations as subroutines. This does however make it a good challenging language to use.

I have the first style HP17BII+ with the small input key. I think the style, weight, shape and overall quality of the calculator is great. It also feels very tactile with the rubberised sides.


Edited: 22 Nov 2007, 5:58 p.m.


#6

You may like to visit the following thread:

http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/forum.cgi?read=128665#128665

Or read the final HHC 2007 report at:

http://www.holyjoe.net/hhc2007/Final_HHC2007_Conference_Report_R2.pdf

where a complete discussion about the contest could be found.

Enjoy, and let us have your views!!

#7

Chris, it's just called the Solver. It was designed to solve equations, but with the ability to loop and use variables, it qualifies as programming, IMHO.


#8

Thanks for the feedback. I have saved the HCC 2007 report to read. By the way Don I thought your solution to the problem looked good.


#9

Thanks Chris. It was fun to do. It made me wish for indirect addressing, however!

#10

Hi Don,

Thanks for posting your code. Don and I have been bouncing the solver versions back and forth for the past few weeks. His version is the fastest. To give a couple of other variations, the following are two of my slower versions:

Selection Sort- 10 Second time (to reverse one 10 digit number) on HP-19BII:

R= 0 * L(K:X) + 
0 * L(Y,LOG(X)) +
0 * SIGMA(N1:1:G(Y):1:
L(D1:IP(10*FP(G(K)/10^N1))) +
L(MAX:G(D1)) +
L(N3:0) +
0 * SIGMA(N2:N1+1:G(Y)+1:1:
L(D2:IP(10*FP(G(K)/10^N2))) +
IF (G(D2) > G(MAX):
L(MAX:G(D2)) +
L(N3:N2):0)
) +
IF (G(N3) > 0:
L(K:G(K)-(G(D1)*10^(N1-1))
+(G(MAX)*10^(N1-1))
-(G(MAX)*10^(G(N3)-1))
+(G(D1)*10^(G(N3)-1)))
:0)
)
+ L(R:G(K))

Another version was to scan for largest digit and build up new number in separate variable. Unfortunately, it's 14 seconds to reverse one 10 digit number:

R= 0 * L(P:0) +
0 * L(K:X) +
0 * L(Y,LOG(X)+1) +
0 * SIGMA(N1:1:G(Y):1:
L(MAX:0) +
0 * SIGMA(N2:1:G(Y):1:
L(D1:IP(10*FP(G(K)/10^N2))) +
IF(G(D1)>G(MAX):
L(MAX:G(D1)) +
L(N3:N2):0)
) +
L(P:G(P)+G(MAX)*10^(N1-1)) +
L(K:G(K)-G(MAX)*10^(G(N3)-1))
) +
L(R:G(P))

It's interesting that the nested IF's in Don's version is a lot faster than straight swapping of variables. A lot has to do with the total number of steps that each pass takes.

I want to thank Don for getting me interested in this problem. It was a lot of fun to try to tweak the code. I'm sure there are more variations that can be done with it.

Bill


Edited: 22 Nov 2007, 10:59 p.m.


Possibly Related Threads...
Thread Author Replies Views Last Post
  17BII & 17BII+ Discounted Payback Period Revisited Tom Neudorfl 8 819 11-25-2013, 10:28 AM
Last Post: Don Shepherd
  HHC 2013 programming contest winners Brian Walsh 52 3,241 09-26-2013, 11:39 PM
Last Post: David Hayden
  HHC / HP Museum Programming Contest for RPN and RPL machines Gene Wright 18 1,349 09-22-2013, 09:39 AM
Last Post: Miguel Toro
  HHC 2012 RPN Programming Contest - 10-Step Way-After-Nashville Solution Jeff O. 32 2,114 10-12-2012, 01:41 AM
Last Post: Paul Dale
  Mini-challenge: HHC2012 RPL programming contest with larger input David Hayden 14 1,044 10-05-2012, 10:36 PM
Last Post: David Hayden
  HHC 2012 RPN Programming Contest Gene Wright 73 2,820 09-28-2012, 12:43 PM
Last Post: x34
  HHC 2012 RPL Programming Contest Gene Wright 33 2,025 09-27-2012, 01:57 AM
Last Post: Werner
  HP Forum HHC Programming contest idea / possible rules Gene Wright 30 1,614 09-26-2011, 08:07 AM
Last Post: Gerson W. Barbosa
  HHC 2011 is 5 weeks away --- bring your 20b/30b to be flashed and the programming contest... Gene Wright 27 1,424 08-21-2011, 05:08 PM
Last Post: gene wright
  Capture the flag - HP-12C programming contest x34 10 741 02-13-2011, 06:59 PM
Last Post: Allen

Forum Jump: