Post Reply 
HHC 2015 RPN programming Contest is now open
10-03-2015, 08:55 AM (This post was last modified: 10-03-2015 08:57 AM by Csaba Tizedes.)
Post: #81
RE: HHC 2015 RPN programming Contest is now open
(10-02-2015 01:01 PM)David Hayden Wrote:  
(10-01-2015 04:30 PM)Peter Murphy Wrote:  Would anyone be willing to discuss the scheme or schemes they used to solve this?
My solution sets the flags that correspond to the dice. So mine sets flags 1, 3, 4, and 5 in the example ... he has a bunch of code to detect duplicate dice ... no need to detect duplicate dice (setting a flag works if the flag is initially set), but the code to detect a small straight is complicated.

Same as my method but I used lots of steps for totally same task:

My method is works on that we store the numbers of dices in R1~R5.
We need one additional register R6 to mark if we have 6 on any dice.
This is that point where my solution grows too high: with indirect addressing I marked each register (steps: 011~023):
Code:

9
STO 6
...
LBL 0
RCL I
RCL (i)
STO I
RCL (i)
ABS
CHS
STO (i)
ROLL DN
ROLL DN
STO I
ISG I
GTO 0

This is totally same but very very long code... Sad If I use flags these steps can shortened.

After marking registers from R1~R6 the original content is remain in each registers only the sign is changed:

If we have 1,1,2,6,6,9 in registers R1~R6, after running above code we have -1,-1,2,6,6,-9 in registers (because on dices we have 1, 2 and 6).

The other part (counting) is also straighforward.

Csaba
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HHC 2015 RPN programming Contest is now open - Csaba Tizedes - 10-03-2015 08:55 AM



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