MC: HP Handheld User's Conference 1999
Programming Contest Results
by Richard J. Nelson
The contest this year was to "improve" the following program by reducing the program bytes required. The technique of making the program a string and using OBJ-> to save bytes is *NOT* allowed. This adds so much to the run time - usually many minutes - that it is not practical. The program is a menu-prompting clock-adjust program to allow seconds, minutes, and hours adjustment. It displays the clock to allow the time to be visible and turns the clock off when the adjustment environment is exited.
'CADJ' << -40 SF { { "S+" << 8192 CLKADJ >> } { "M+" << 491520 CLKADJ >> } { "H+" << 29491200 CLKADJ >> } { "S-" << -8192 CLKADJ >> } { "M-" << -491520 CLKADJ >> } { "H-" << -29491200 CLKADJ >> } { "EXIT" << -40 CF 0 MENU >> } } TMENU >> 282.5 Bytes, # DFFFh.
Two approaches are possible. Improve the program using TMENU or use a different user interface that uses the same basic elements:
RULES
Additional rule clarifications given at the conference:
Ten programs were submitted. One was disqualified (the Shortest one) because it did *NOT* turn on the clock. Most of the programs were received at the last minute except the winning entry which was submitted three hours earlier.
HP donated the prizes. They felt that it would be more fun if the prizes were *NOT* known ahead of time. Also contrary to our custom the second and third prize winners were not able to have their choice of prizes. I heard that second and third winners would liked to have switched.
FIRST Prize: HP Jornada Palmtop computer with laptop carry case. Has nice pocket for the palmtop.
Second: HP Watch, HP Hat, and ?
Third: HP Stainless Steel Thermos and ?
Here are the winning programs in order.
'JGS' << " H- M- S- S+ M+ H+" 7 DISP 5 8 * NEG DUP SF WHILE 0 WAIT DUP PICT TYPE < REPEAT 13.6 - 5 3 %T OVER ABS 2 INV - ^ 8192 * SWAP SIGN * CLKADJ END DROP CF >> 147.0 Bytes, # C021h. John Gustaf Stebbins 'JYA' << 8 -5 * SF " S+ M+ H+ S- M- H-" 7 DISP IFERR DO 1 5 3 %T DUP DUP * 3 ->LIST 8192 * DUP NEG + 0 WAIT IP 1 ALOG - GET CLKADJ UNTIL 0 END THEN 2 DROPN END 8 -5 * CF >> 155.5 Bytes, # B6D1h. Jean-Yves Avenard 'DTM' << -5 8 * "SF{:H-:-29491200:H+:29491200:M+:491520: M-:-491520:S-:-8192:S+:8192}" OBJ-> TMENU DO "" DUP IFERR INPUT THEN DROP2 1 ELSE IFERR OBJ-> CLKADJ THEN 1 ELSE 0 END END UNTIL END -5 8 * CF 0 MENU >> 177.0 Bytes, # F9E7h. Detlef Mueller
Every programmer looked at the others and saw ways their program could be improved. What is the optimum program? It is one that will give comparable performance as the example Program and be less than 147 bytes.
Judging these is always difficult. It must be done is a short time, everyone is waiting, and it should be fair and consistent. Did 'DTM' violate the no string, OBJ-> "rule"?
It was not noticed until later. My response to the question when asked was that a "short" sequence that was essential to the structure of the program was OK. This is clearly in the "gray" area. Ten programs were submitted, mine, written at the time as well, made eleven. The spread of approaches and the wealth of ideas to study is what makes the stress worth it for me. No one would give their byte number so I announced mine, final 158 Bytes, as a guide during the two days of programming during the contest.
The problem this year was a little different and I didn't plan on a contest until the last minute so considering everything I think it was a success. Of course everyone who didn't have the lowest byte program may think differently. I hope we all had fun and I think we can plan on a contest next year. I can't guarantee such a nice first prize however.
Richard Nelson
Note: The program had to run on the 48G series. One reader (Bruce Horrocks) submitted an S series-only program that's far smaller than any of the G-series programs:
'B.H' << 8 -5 * SF 6 SQ MENU >> 35 bytes, #B07Fh