Skip to main content
4 of 14
added 4 characters in body
kglr
  • 400.5k
  • 18
  • 488
  • 929

If we know tuples is constructed from 3 grids, we can extract the lengths using:

lF = Map[l |-> Total @ Normalize[#, Min]& @ GroupBy[#, #[[l]]& -> Most, Length]]&


ngrids = 3;

lengths = lF[tuples] @ Range[ngrids]
{6, 6, 5}

Then, we can use a combination of ArrayReshape and Extract to get the three grids:

reshaped = ArrayReshape[tuples, Append[Length @ First @ tuples] @ lengths];

positions = Map[{Splice @ RotateRight[{1, 1, All}, #], #} &] @ Range[ngrids];

Extract[reshaped, positions]

% == {grid1, grid2, grid3}
 True
kglr
  • 400.5k
  • 18
  • 488
  • 929