HHC 2015 RPN programming Contest is now open
10-15-2015, 08:05 PM
Post: #101
 Thomas Klemm Senior Member Posts: 1,447 Joined: Dec 2013
RE: HHC 2015 RPN programming Contest is now open
(10-15-2015 11:51 AM)Jeff O. Wrote:  Thanks for the information, and for not telling me to "RTFI" (Read the Fine Internet). :-)

I see the internet not as a given but as something we weave with our posts, questions and answers. Of course, we can google everything. But from somewhere, the connections also come.
If you see someone with a map, who acts lost, you can still show him the way, even if he holds all the information required in his hands.
It was far from obvious what you have to search for to solve your problem. The Wikipedia article describes the general solution better than I could ever explain. So thanks for making me read it.

Kind regards
Thomas
10-16-2015, 10:40 AM
Post: #102
 Werner Senior Member Posts: 525 Joined: Dec 2013
RE: HHC 2015 RPN programming Contest is now open
Thanks for the nice words, Jeff!
Werner
10-20-2015, 04:35 PM (This post was last modified: 01-26-2016 09:08 PM by Guenter Schink.)
Post: #103
 Guenter Schink Senior Member Posts: 349 Joined: Dec 2013
RE: HHC 2015 RPN programming Contest is now open
(09-30-2015 12:23 PM)Gene Wrote:
(09-29-2015 09:25 AM)Werner Wrote:  Managed to squeeze off a byte:
42 bytes
.....
Cheers, Werner

Gene: Werner, of all the code posted so far, yours is the one I like the best. It is short and disturbs other aspects of the machine the least. If you don't mind, I'd like to incorporate some modification of your approach into my Yahtzee game for the funstuff rom?

Nearly *every* posting here is shorter than my efforts, which is why I posed this as the programming contest problem. :-)

I will post my version and Gunter's version from the conference later today if at all possible.

thanks all...

After the conference Torben and I continued our trip through southeast USA via Memphis, Columbia and Charleston back to Dulles Airport. And after that I spent a couple of days at Vienna, Austria. Therefore I'm somewhat late at this subject.
But I guess that my code -winning the contest at the conference- may be still of interest. [edited a typo]

47 bytes
Code:
 01 LBL 'RR 00 2XEQ 'SORT 03 RCL 02      If die two is 2 04 RCL 04      and die 4 is 5 05 * 06 10 07 X=Y?         then there is no straight 08 RTN 09 2.005 10 STO 06      init loop counter 11 FRC 12 STO 07      init match counter 13 RCL 01      first die 14LBL 00      start loop 15 1 16 +               add 1 to die 17 RCL IND 06    get next die 18 X=Y?          if true we have a match 19 ISG 07       and increase the match count 20 ISG 06       next die 21 GTO 00 22 3 23 RCL 07      were there 3 or more matches? 24 X>Y?        if true we have a straight and ... 25 CLX         return 0, otherwise leave as it is 26 END

Eventually I looked for squeezing some bytes while retaining the same logic. Here is the result. Using the stack only and DSE instead of ISG, no registers, no flags.

42 bytes
Code:
 01 LBL 'RR 02 XEQ 'SORT 03 RCL 02 04 RCL 04 05 * 06 10 07 X=Y? 08 RTN 09 4 10 RCL 05 11 ENTER ^ 12 LBL 00 13 SIGN 14 - 15 RCL IND Y 16 X=Y? 17 DSE T 18 X<>Y 19 DSE Z 20 GTO 00 21 R^ 22 8 23 x>Y? 24 CLX 25 END

But I must admit that I rate Werner's code as more elegant and perhaps easier to understand. My luck he wasn't at the conference

Günter
 « Next Oldest | Next Newest »

User(s) browsing this thread: 2 Guest(s)