Is it possible to swap tiles in 2x3 grid using rotations of 2x2 squares?

78 Views Asked by At

I'm trying to understand how to solve the Number Rotation Puzzle aka Twiddle.

I want to try to figure it out mostly myself but I need a little help. I've written a program to explore the puzzle, and from experimentation I suspect that it may not be possible to swap all pairs of tiles if we are constrained to rotating a 2x2 square within a 2x3 grid.

Is this correct please? If so, how could it be proved?

I'm thinking that there are only 16 possible permutations of positions based on 4 rotations for each 2x2 square, but I don't trust that as looked at in another way I think there are $6!$ potential permutations if all are reachable.

As you can probably see my grasp of both combinatorics and group theory is pretty weak - I am using this activity to try to improve my understanding of these topics.

Any help much appreciated.

enter image description here enter image description here

1

There are 1 best solutions below

1
On

Brute-force in Python:

all = {"123456"}
size = len(all)

while True:
    newall = set()
    for item in all:
        lrot = item[3]+item[0]+item[2]+item[4]+item[1]+item[5]
        newall.add(lrot)
        rrot = item[0]+item[4]+item[1]+item[3]+item[5]+item[2]
        newall.add(rrot)
    all = all.union(newall)
    newsize = len(all)
    if newsize == size:
        break
    size = newsize

print(size)
print(all)
print("123654" in all)

(Basically, start with the set consisting of the single configuration $\begin{array}{c|c|c}1&2&3\\\hline4&5&6\end{array}$ and then apply the two available transforms until the set of all configurations stops growing).

The program outputs this:

120
{'546132', '514263', '531462', '456123', '341265', '152463', '423615', '216543',
 '362415', '561234', '512436', '253146', '134652', '524631', '256431', '243651', 
 '145326', '413526', '635142', '321654', '354162', '364251', '352641', '462531', 
 '416235', '652134', '461325', '654321', '254613', '631524', '213465', '645231', 
 '642513', '643125', '623541', '431256', '625314', '453261', '142635', '543216', 
 '516324', '146253', '523164', '135264', '264135', '435621', '615423', '154236', 
 '651243', '235416', '365124', '164523', '532614', '412653', '614532', '463152', 
 '613254', '241536', '245163', '126534', '521346', '356214', '263514', '562143', 
 '261453', '125643', '612345', '236154', '346521', '425136', '246315', '451632', 
 '325461', '564312', '421563', '231645', '312564', '324516', '621435', '315246', 
 '426351', '143562', '124365', '316452', '432165', '436512', '214356', '342156', 
 '452316', '542361', '163245', '513642', '534126', '153624', '536241', '624153', 
 '314625', '345612', '641352', '123456', '234561', '265341', '351426', '526413', 
 '251364', '326145', '156342', '632451', '132546', '165432', '162354', '541623', 
 '361542', '215634', '653412', '136425', '563421', '634215', '415362', '465213'}
False

The last 'False' means that $\begin{array}{c|c|c}1&2&3\\\hline6&5&4\end{array}$ cannot be obtained.