11-1100/Assignment I - Permutation Counting

From Drorbn
Revision as of 23:03, 10 October 2011 by Josh.seaton (talk | contribs)
Jump to navigationJump to search

The puzzle that I have chosen is a 2x2x3 variant of the Rubik's cube. Below is a sketch of how I have labelled.

2x2x3 Permutation Puzzle


Here are the generators:

g1 = [1,2,3,4,12,22,7,8,6,11,21,28,13,14,15,16,17,18,5,10,20,27,23,24,25,26,9,19,29,30,31,32] (28,19,5,12)(9,6,22,27)(10,11,21,20)

g2 = [1,2,13,23,5,6,7,4,9,10,11,12,30,14,15,16,17,3,19,20,21,22,29,24,25,26,27,28,8,18,31,32] (18,3,13,30)(8,4,23,29)

g3 = [14,24,3,4,5,6,2,8,9,10,11,12,13,32,16,26,1,18,19,20,21,22,23,31,15,25,27,28,29,30,7,17] (32,17,1,14)(24,31,7,2)(16,26,25,15)

g4 = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,22,23,24,25,26,17,18,19,20,21,32,31,30,29,28,27] (17,22)(18,23)(24,19)(25,20)(26,21)(32,27)(28,31)(29,30)


This is the Python code used to implement the NCGE algorithm for the 2x2x3 puzzle.

NCGE Python Code

First, the class of permutations is defined, along with how to multiply them and take their inverses. Then, algorithm is spelled out.

The algorithm yields that their are 39016857600 different configurations of the 2x2x3 puzzle. The implementation was subsequently checked with the Rubik's cube generators given on the handout and the correct numbers were outputted.