Post Reply 
HHC 2015 RPN programming Contest is now open
09-27-2015, 09:11 PM (This post was last modified: 09-27-2015 09:14 PM by Gerson W. Barbosa.)
Post: #15
RE: HHC 2015 RPN programming Contest is now open
Recall arithmetic wasn't missed this time, but the lack of some comparison tests on the HP-41 is always a problem, at least for me. Not so much improvement when compared to the first version this morning:

Code:

.........................

01>LBL 'RR 
02 XEQ 'SORT 
03 CLX
04 STO 06
05 STO 07
06 4
07 STO 00
08 SIGN
09>LBL 00
10 RCL IND 00
11 CHS
12 RCL 00
13 RCL Z
14 +
15 RCL IND X
16 X<>Y
17 RDN
18 +
19 X=Y?
20 ST+ 06
21 X<>Y
22 X>Y?
23 ST+ 07
24 DSE 00
25 GTO 00
26 RCL 07
27 RCL 06
28 X<=Y?
29 GTO 01
30 3
31 X>Y?
32 GTO 01
33 RCL 04
34 RCL 02
35 -
36 X<>Y
37 X<=Y?
38 GTO 01
39 FRC
40 RTN
41>LBL 01
42 SIGN
43 END

The program returns 0 for small straights and 1 othewise.

.........................

01>LBL 'SORT      ; Sort routine by Jean-Marc Baillard
02 1.005
03 SIGN
04>LBL 01
05 LASTX
06 LASTX
07 RCL IND L
08>LBL 02
09 RCL IND Y
10 X>Y?
11 GTO 03
12 X<>Y
13 LASTX
14 +
15>LBL 03
16 RDN
17 ISG Y
18 GTO 02
19 X<> IND L
20 STO IND Z
21 ISG L
22 GTO 01
23 END
.........................

Gerson.



Edited to fix a typo
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 - Gerson W. Barbosa - 09-27-2015 09:11 PM



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