1d Rubik's Cube for HP 35s



#4

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


#5

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

#6

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


Possibly Related Threads…
Thread Author Replies Views Last Post
  HP-71B - thanks to Marcus von Cube for MATH ROM article Michael Lopez 2 1,444 03-03-2013, 07:19 AM
Last Post: Paul Berger (Canada)
  Cube root on standard calculator Thomas Klemm 22 6,489 11-09-2012, 06:11 AM
Last Post: Pierre
  Archaeology attack: Rubik's Cube on the 41 Ángel Martin 17 3,637 05-26-2010, 03:03 AM
Last Post: Paul Dale
  Merry X-Mas: ICEBOX.ROM version 1D Geir Isene 1 989 01-10-2009, 04:51 PM
Last Post: Geir Isene
  HP 50G Cube Root of Negative Hal Bitton in Boise 8 1,980 10-16-2008, 06:52 PM
Last Post: V-PN
  Cube root of negative number (HP 50G) macky 3 1,173 09-18-2008, 06:06 AM
Last Post: Walter B
  A practical application for cube root Karl Schneider 22 14,833 01-30-2007, 09:13 PM
Last Post: Ron
  49g+ Cube roots Kellie 15 3,508 02-26-2004, 08:04 PM
Last Post: Kellie

Forum Jump: