Post Reply 
HHC 2015 RPN programming Contest is now open
09-28-2015, 01:52 AM (This post was last modified: 09-28-2015 02:02 AM by David Hayden.)
Post: #29
RE: HHC 2015 RPN programming Contest is now open
[ Edit: OOPS! Nevermind. I completely discounted a die that rolls 6. In fact the whole thing is wrong]

18 steps and 35 bytes, if I'm counting the bytes right. No registers, no sorting.

Code:

01 LBL RR    # 6 bytes
02 5    # 1 byte

# Set the flag for the register in X
03 LBL 01     # 1 byte
04 RCL IND X  # 2 bytes
05 SF IND X # 2 bytes?
06 X<>Y     # 1 byte
07 DSE X    # 2 bytesG
08 GTO 01    # 2 bytes
# Note that X=0 when you exit this loop

# Now compute the result in flag 01, clear the flags along the way
09 FS?C 05    # 2 bytes
10 SF 01    # 2 bytes   F1 = F1 or F5
11 FC?C 02    # 2 bytes
12 CF 01    # 2 bytes   F1 = (F1 or F5) and F2
13 FC?C 03 # 2 bytes
14 CF 01    # 2 bytes   F1 = (F1 or F5) and F2 and F3
15 FC?C 04 # 2 bytes
16 CF 01    # 2 bytes   F1 = (F1 or F5) and F2 and F3 and F4
   
# X is zero as mentioned above. If F1 is clear, then set it to 1.
17 FC?C 01    # 1 bytes
18 1    # 1 byte
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 - David Hayden - 09-28-2015 01:52 AM



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