As with
Shuffle
the graphic represents an unfolded cylinder but with two rotatable rings around its girth.
Each band contains nine blocks.
There are three vertical slots which intersect these bands; the slots will always carry 3 blocks although their length is for four.
At any one time, if a block in one vertical is moved up or down, the blocks in the other slots move simultaneously in the same direction.
Horizontal bands may be rotated left or right as many places as you wish (but one place per click).
Your objective is to create a 9 letter word, all letters different, in the top band which has some relevance to the problem's title (a medium perhaps). As a secondary bonus the lower band should confirm both your word and the title.
A program to produce PARCHMENT on the top row was similar to that shown below, which works at it from the other direction, that is, to seek to form PAPYRUSxx on the bottom row, or some rotation of that, preferably with the set of letters that can form PARCHMENT in the first row, with the left-over MyX in the three holding positions.
The program that produced PARCHMENT in the top row did not work out, as the letters left in the bottom row were not those that would form PAPYRUSxx.
The three that leave the letters of PARCHMENT in the top row are:
2 5 3 3 6
0 1 1 1 1
hrtcnemap yrusxxpap mxy
4 7 3 4 4
2 1 5 5 4
rtamcehpn xxpapyrus mxy
5 1 1 8 5
7 1 4 0 1
enramcthp xxpapyrus ymx
These all start with a Down and alternate D and U between as made more clear in the description of the middle one of these below.
These were chosen from the output of the program shown below as these are the ones that also leave all the letters for PARCHMENT in the top row, though not in the correct order. And since the unused M, x and Y are in the holding positions adjacent to the top row (rather than the bottom), we can use sequences of moves involving only Left and Right moves on the top row. This avoids upsetting the bottom row, as three of the letters just move in and out of the bottom holding positions, so long as the first move is downward and the final move is upward.
The middle one allows for the sorting of PARCHMENT into the correct order in the least number of swaps in a bubble sort.
4 7 3 4 4
2 1 5 5 4
rtamcehpn xxpapyrus mxy
Translating, we get:
Start with
D 4R U 2L D 3R U 4R D 4R U
2R 1R 4L 4L 4R
rtamcehpn xxpapyrus mxy
where the upper row applies to the upper row on the device, and the lower row applies to the lower row on the device. The two rows are left as
RTAMCEHPN
xxPAPYRUS
with the unneeded M, x and Y in the holding positions at the top.
The program to produce the three (as well as the others, that didn't leave the appropriate letters in the top row), is:
Dim topRow, botRow, hold(3), posn, hT(10), hB(10)
Private Sub cmdSolve_Click()
Me.FontTransparent = False
topRow = "rmhutnppa"
botRow = "smeyapyrc"
posn = "u"
For i = 1 To 3: hold(i) = "x": Next
twist 1
End Sub
Sub twist(lvl)
DoEvents
Dim hHold(3)
If lvl < 5 Then
CurrentX = 1: CurrentY = 1:
For i = 1 To lvl - 1
Print hT(i); hB(i);
Next
End If
For i = 1 To 3: hHold(i) = hold(i): Next
hPosn = posn
hTop = topRow: hBot = botRow
If posn = "u" Then
h = Mid(botRow, 4, 1)
Mid(botRow, 4, 1) = Mid(topRow, 4, 1)
Mid(topRow, 4, 1) = hold(1)
hold(1) = h
h = Mid(botRow, 6, 1)
Mid(botRow, 6, 1) = Mid(topRow, 6, 1)
Mid(topRow, 6, 1) = hold(2)
hold(2) = h
h = Mid(botRow, 9, 1)
Mid(botRow, 9, 1) = Mid(topRow, 9, 1)
Mid(topRow, 9, 1) = hold(3)
hold(3) = h
posn = "d"
Else ' posn is "d" (down); move will be up
h = Mid(topRow, 4, 1)
Mid(topRow, 4, 1) = Mid(botRow, 4, 1)
Mid(botRow, 4, 1) = hold(1)
hold(1) = h
h = Mid(topRow, 6, 1)
Mid(topRow, 6, 1) = Mid(botRow, 6, 1)
Mid(botRow, 6, 1) = hold(2)
hold(2) = h
h = Mid(topRow, 9, 1)
Mid(topRow, 9, 1) = Mid(botRow, 9, 1)
Mid(botRow, 9, 1) = hold(3)
hold(3) = h
posn = "u"
End If
test$ = botRow & botRow
If InStr(test$, "papyrusxx") > 0 Then
For i = 1 To lvl - 1
txtSolution.Text = txtSolution.Text & Str(hT(i))
Next i
txtSolution = txtSolution & Chr(13) & Chr(10)
For i = 1 To lvl - 1
txtSolution.Text = txtSolution.Text & Str(hB(i))
Next i
txtSolution.Text = txtSolution.Text & Chr(13) & Chr(10)
txtSolution.Text = txtSolution.Text & topRow & " " & botRow & " "
txtSolution.Text = txtSolution.Text & hold(1) & hold(2) & hold(3) & Chr(13) & Chr(10) & Chr(13) & Chr(10)
Else
If lvl < 6 Then
For topAmt = 1 To 8
hT(lvl) = topAmt
topRow = Right(topRow, 1) & Left(topRow, 8)
For botAmt = 0 To 8
hB(lvl) = botAmt
twist lvl + 1
botRow = Right(botRow, 1) & Left(botRow, 8)
Next
Next
End If
End If
topRow = hTop: botRow = hBot
posn = hPosn
For i = 1 To 3: hold(i) = hHold(i): Next
End Sub
Then to sort the top row into the correct order:
To sort the RTAMCEHPN into PARCHMENT requires the following pairwise position swaps, created by keeping track of the swaps in a bubble sort:
23 34 45 56 67 78 89 12 34 56 67 45 56 45 34 23 12
To accomplish each of these swaps, we need an algorithm (sequence of moves) that will swap one given adjacent pair of letters. One such is:
D 1R U 1R D 2R U 3L D 4L U 1L D 1L U 2R D 3R U
It was found by a program similar to those that solved Shuffle.
It will reverse positions 1 and 2 in the top row if the R's and L's are applied only to that row, so if it is done 17 times with appropriate conjugations in between to move the needed swap pair into positions 1 and 2, it will produce PARCHMENT without upsetting PAPYRUS, as it does start with a D move and ends with a U move. This was determined by a program like the one for Shuffle.
So once PAPYRUSxx has been formed on the bottom, leaving RTAMCEHPN on the top, the following sequnce will finish the job:
1L
D 1R U 1R D 2R U 3L D 4L U 1L D 1L U 2R D 3R U
1L
D 1R U 1R D 2R U 3L D 4L U 1L D 1L U 2R D 3R U
1L
D 1R U 1R D 2R U 3L D 4L U 1L D 1L U 2R D 3R U
1L
D 1R U 1R D 2R U 3L D 4L U 1L D 1L U 2R D 3R U
1L
D 1R U 1R D 2R U 3L D 4L U 1L D 1L U 2R D 3R U
1L
D 1R U 1R D 2R U 3L D 4L U 1L D 1L U 2R D 3R U
1L
D 1R U 1R D 2R U 3L D 4L U 1L D 1L U 2R D 3R U
2L
D 1R U 1R D 2R U 3L D 4L U 1L D 1L U 2R D 3R U
2L
D 1R U 1R D 2R U 3L D 4L U 1L D 1L U 2R D 3R U
2L
D 1R U 1R D 2R U 3L D 4L U 1L D 1L U 2R D 3R U
1L
D 1R U 1R D 2R U 3L D 4L U 1L D 1L U 2R D 3R U
2R
D 1R U 1R D 2R U 3L D 4L U 1L D 1L U 2R D 3R U
1L
D 1R U 1R D 2R U 3L D 4L U 1L D 1L U 2R D 3R U
1R
D 1R U 1R D 2R U 3L D 4L U 1L D 1L U 2R D 3R U
1R
D 1R U 1R D 2R U 3L D 4L U 1L D 1L U 2R D 3R U
1R
D 1R U 1R D 2R U 3L D 4L U 1L D 1L U 2R D 3R U
1R
D 1R U 1R D 2R U 3L D 4L U 1L D 1L U 2R D 3R U
Altogether there are 38 moves to form xxPAPYRUS on the lower row, 21 conjugation moves (between the swap series), and each of the 17 swap series has 28 moves, totalling 17x28=476.
That adds up to 535 moves or button presses on the interactive diagram.
I'm sure there are shorter ways. I had learned this methodology of using conjugations together with series of moves that accomplish simple tasks from David Singmaster's Notes on Rubik's Magic Cube. But as you can see from the length of the solution, it certainly is not "God's Algorithm".
Edited on January 15, 2009, 1:33 pm
|
Posted by Charlie
on 2009-01-15 13:30:58 |