Post Reply 
HHC 2017 RPN Programming contest information and results thread
09-18-2017, 03:05 AM (This post was last modified: 09-18-2017 03:19 AM by Didier Lachieze.)
Post: #18
RE: HHC 2017 RPN Programming contest information and results thread
Aha.... I didn't think using ATOX for the digit extraction, shame on me.

So here is my program in 75 bytes (68 + 7 for register 00). The good thing is that it works on the 41C without any module.
Code:
Step Bytes Instruction 
 1    9    LBL "HAPPY"
 2    1    CLA
 3    2    FIX 0
 4    2    CF 29
 5    1    0
 6    1    STO 00
 7    1    LBL 01
 8    1    CLx
 9    1    x<>y
10    2    ISG 00
11    1    LBL 02
12    2    STO Z
13    2    10
14    1    MOD
15    1    x^2
16    1    +
17    1    X<>Y
18    2    10
19    1    /
20    1    INT 
21    1    x#0?
22    2    GTO 02
23    1    SIGN
24    1    x=y?
25    2    GTO 03
26    1    3
27    1    +
28    1    x#y?
29    2    GTO 01
30    3    "UN"
31    1    LBL 03
32    8    "|-HAPPY "
33    2    ARCL 00
34    1    AVIEW
35    2    SF 29
36    2    FIX 4
37    3    END
     68

And here is a solution in 69 bytes using ATOX:
Code:
Step Bytes Instruction 
 1    9    LBL "HAPPY"
 2    2    FIX 0
 3    2    CF 29
 4    1    0
 5    2    STO Z
 6    1    LBL 01
 7    1    CLx
 8    1    x<>y
 9    1    CLA
10    2    ARCL X
11    1    RDN
12    2    48
13    2    ISG Z
14    1    LBL 02
15    2    48
16    1    -
17    1    x^2
18    1    +
19    2    ATOX
20    1    x#0?
21    2    GTO 02
22    1    SIGN
23    1    x=y?
24    2    GTO 03
25    1    3
26    1    +
27    1    x#y?
28    2    GTO 01
29    3    "UN"
30    1    LBL 03
31    8    "|-HAPPY "
32    2    ARCL Z
33    1    AVIEW
34    2    SF 29
35    2    FIX 4
36    3    END
     69
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HHC 2017 RPN Programming contest information and results thread - Didier Lachieze - 09-18-2017 03:05 AM



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