1d Rubik's Cube for HP 35s Message #1 Posted by Andrew Nikitin on 7 Sept 2008, 7:58 p.m.
I bought myself an HP35s recently and as an excersize I programmed this game for it. Not that it can compete with this game, but still.
The goal is to arrange digits 12345678 in order.
The "move" takes a block of 4 digits located somewhere within the sequence and reverses them.
Start with XEQ X. This will produce some permutation of digits 1..8. Top row shows number 12345  these are 5 possible moves. "1" will reverse first 4 digits, 2 will reverse 4 digits starting with the second, and so on.
Type n R/S to perform move number n.
Repeat until digits are in order.
X001 LBL X
X002 ALL
X003 12345678
X004 STO X
X005 9
X006 STO J
X007 RANDOM
X008 5
X009 ×
X010 IP
X011 XEQ X028
X012 DSE J
X013 GTO X007
X014 12345
X015 RCL X
X016 STOP
X017 IP
X018 x<=0?
X019 GTO X014
X020 5
X021 x<>y
X022 x<=y?
X023 XEQ X025
X024 GTO X014
X025 +/
X026 5
X027 +
X028 10^x
X029 STO K
X030 RCL X
X031 x<>y
X032 INT÷
X033 x<> K
X034 4
X035 STO I
X036 RCL I
X037 10
X038 ×
X039 RCL K
X040 LASTx
X041 STO÷ K
X042 RMDR
X043 IP
X044 +
X045 DSE I
X046 GTO X037
X047 RCL K
X048 FP
X049 10000
X050 ×
X051 
X052 ×
X053 STO+ X
X054 RTN
Uses registers X, K, I, J
Edited: 28 Sept 2008, 5:02 p.m. after one or more responses were posted
