Wednesday, April 13, 2016

Making sense out of chaos: ordering expand-shrink moves

To understand Ringiana (for Android and iPhone)  and Ringsanity (iPhone)  we are going to develop some notations for moves that occur in these games. The most interesting moves, the expand-shrink moves, are common to both games. Every Ringsanity move is an expand-shrink, while Ringiana also has swap or transposition  moves, which exchange two adjacent arcs. 

We  will call expand-shrink moves ES-moves, for lack of a good verb to describe this novel action. An ES-move expands a quarter of the ring into two, either clockwise or counterclockwise, and shrinks the two quarters into one. 
The two shrinking quarters are located along the ring either clockwise or anticlockwise after the expanding quarter. 
Here is a video with a bunch of ES-moves in Ringsanity 

 In Ringsanity only the outer ring moves, while colors of the inner disk remain static. The goal, recall, is to match the colors of the outer ring with those of the inner disk. In Ringiana for iPhone Sergey Nemirovsky (who did almost all the coding) composed ES-moves with radial shrinking and expansion for fancier animations.

 Nikolay Gromov coded Ringiana for Android in OpenGL with a distinctly 3D appearance. ES-moves are still there, but their animations look different. By the way, fancy programming in OpenGL and for Android is not Nikolay's main work. He is a professor of theoretical physics and writes fancy papers such as Quark-anti-quark potential in 4D SYM.

Having looked at implementations of ES-moves, we return to their classification.  There is a total of 8 moves in Ringsanity:  the ring has four quarters, and each quarter can be expanded clockwise or anticlockwise. A programmer would label these moves 0 through 7. As a mathematician, I start with 1 and will label them 1 through 8, adding prefix e  and denoting the moves e1, e2, e3, ..., e8. 

When a mathematician decides to introduce some order in the two-dimensional plane, she often sets up a coordinate system. Let's do that, placing the center of coordinates at the center of the inner disk. Schematically: 
 Outer ring is shown as a shade of yellow, and inner disk light pink. The four quadrants are I, II, III, IV going anticlockwise starting from the Northeast quadrant. 

The four quadrants perfectly match the four quarters of the outer ring. We follow counterclockwise convention and also start with quadrant I. Moves e1, e2 will denote expanding quadrant I piece clockwise and anticlockwise: 
e1 expands piece I counterclockwise and shrinks pieces III and IV into a single piece that will occupy quadrant III. After expansion, piece I occupies quadrants I and IV. 

e2 expands piece I clockwise and shrinks pieces II and III into a single piece that will occupy quadrant III. Following the expansion, piece I occupies quadrants I and II. 

We proceed counterclockwise. Moves e3 and e4 expand the piece in quadrant II, clockwise and anticlockwise, correspondingly: 

 
We proceed, denoting clockwise and anticlockwise expansions of piece III by e5, e6, and the two expansions of piece IV by e7, e8. Here is the diagram of all the moves, where the arrows indicate direction of expansion, clockwise or anticlockwise: 

Now for some applications. Spoiler alerts--we're going to solve levels 1, 3, and 10 of Ringiana, and in few steps. You might want to pause and crack them on your own first!  

Ringiana level 1 is solved by the e2 move:
Ringiana level 3 takes two moves, e5 followed by e8: 
We write this sequence of moves e5e8 or simply e58.
Ringiana level 10 is done in four moves: 
Can you write them down? They are e6, e2, e4, e8. We write the solution as e6e2e4e8 or, shorter, e6248. Each of these moves expands-shrinks counterclockwise, so they are all "anticlockwise" moves. These are exactly the four anticlockwise moves in Ringiana, e2, e4, e6, e8--carrying even labels. The clockwise moves are e1, e3, e5, e7, exactly those with odd labels. In Ringiana notation, odd=clockwise and even=anticlockwise. 

Can you find other Ringiana and Ringsanity levels that can be solved by only clockwise or only anticlockwise moves? 

No comments:

Post a Comment