The Museum of HP Calculators

HP Forum Archive 18

[ Return to Index | Top of Index ]

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
X008 5
X009 ×
X010 IP
X011 XEQ X028
X012 DSE J
X013 GTO X007
X014 12345
X015 RCL X
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
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

Re: 1d Rubik's Cube for HP 35s
Message #2 Posted by Antonio Maschio (Italy) on 8 Sept 2008, 8:46 a.m.,
in response to message #1 by Andrew Nikitin

Nice game.

Now you should substitute the HTML groups with textual forms:

&#8804; with <= (e.g. x<=y?)
&#8596; with <> (e.g. x<>y)

This would improve readability.

-- Antonio

Re: 1d Rubik's Cube for HP 35s
Message #3 Posted by Paul Dale on 8 Sept 2008, 6:21 p.m.,
in response to message #1 by Andrew Nikitin

Interesting little puzzle. I seem to remember something similar for the Casio-FX602P -- I don't remember if I wrote it or it came in the program library. The move possibilities were more limited from memory.

The largest number of moves to solve any legal position is 10 (e.g. 24175386). There are also unsolvable numbers.

- Pauli

[ Return to Index | Top of Index ]

Go back to the main exhibit hall