algorithm - How to find all combinations of multiple 2D arrays(matrix) , rotation allowed -
i have 3 2d arrays(matrix) 0 , 1-
for each array, rotate 4 times clock-wise , 4 times anti clock-wise , flip array , repeat above , each iteration repeat steps other array , on combine array build symmetry or kind of rubik's cube 5 elements each side. means if add 2 arrays , means 1 of array 1 must fit 0 of array 2. following kind of structure-
following 3 arrays
0 0 1 0 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 0 1 1 ------------- 0 1 0 1 0 0 1 1 1 0 1 1 1 1 1 0 1 1 1 0 0 0 1 0 0 ------------- 1 0 1 0 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 0 1 0 -------------
this problem evolved problem asked how solve 5 * 5 cube in efficient easy way.
consider rotate methods follows - rotateleft() rotateright() flipside() (firstarray){ element = single.rotateleft(); for(secondarray){ element2 = single.rotateleft(); if(element.combine(element2){ for(thirdarray){ } } } }
currently have fixed 3 arrays , how , efficiently must solve problem.
Comments
Post a Comment