[math-fun] Re: State Diagram of Hanoi & BLT
Say "Obvious Trinary" (OT) representation for the Towers of Hanoi is that the digits from least to most significant represent the disks from smallest to biggest, and each digit says which pile a disk is on. I'll call my representation "Binary-Like Trinary" (BLT). I wonder whether it's the same one Fred Lunon was talking about. Loosely, Gray Code : Obvious Trinary (one digit changes at a time) :: Regular binary : Binary-Like Trinary (easy to compare) Here's the state diagram for the three-disk puzzle, labeled in BLT: 111 110 112 101 100 121 102 011 120 010 122 012 001 000 211 021 002 210 020 212 201 022 200 221 202 220 222 All the outside-edge paths look like binary counting. The wikipedia page has a similar diagram labeled in OT: http://en.wikipedia.org/wiki/Tower_of_Hanoi#Graphical_representation The spacial arrangement, and the rule, "Take the move that gets you closest by Euclidean distance," are simpler intuitively, but I think they're harder to code than the rules based on BLT digits: A legal move in BLT (for any d, e in {0,1,2} ) is: { ..., d, n e's } <==> { ..., e, n d's } where 0 <= n < the number of digits. The "direction" toward target T from state S is: The most significant digit in T that differs from the corresponding digit in S. To move from S in direction D: Make the move that changes the least significant digit of S that is not D, to D. So, to take a shortest path from S to T: s := S while s != T: d := direction from s to T move from s in direction d s := new location There is just one shortest path from any point to a corner state. For other targets, looks like there can be at most two shortest paths. For instance, going from 022 to 120, the algorithm above takes the path 022, 021, 012, 011, 100, 102, 120, but the other shortest path is 022, 200, 201, 210, 211, 122, 120. Haven't figured out the OT <==> BLT mappings. Mumble subtract mod 3. I keep wondering what physical puzzle might correspond to Gray code. It ought to be simpler than the Towers of Hanoi, but it's not. Towers of Hanoi: you can move a disk iff there are no smaller disks on the piles you're moving it from or to. Gray code: you can move a disk iff the next-smaller disk (if any) is in state 1 and any even-smaller disks are in state 0. ??? --Steve
participants (1)
-
Steve Witham