Nil randomly appearing in a list of lists

Hello everyone,

I will try to keep the explanation of the problem as short and simple as possible.
And put the whole long code at the bottom. I added some further comments into the code for more context.

In my code, I am generating a list - “metapermutation” and then comparing that list to other lists inside of a list - “~listmeta” via

num = ~listmeta.detectIndex({arg itemd, id; itemd == metapermutation});

deleting the first matching one and adding the “metapermutation” into the other list called “~metacontrast”

~listmeta.removeAt(num);
~metacontrast = ~metacontrast.add(metapermutation.deepCopy);

In the ~listmeta list, there are 1024 lists and 360 of them are eventually compared with the generated lists and removed.

(Just for context. this is a part of a bit bigger code and the whole point is to, based on the randomly picked first permutation, create a “path” where each new list/permutation is as different as possible to all the previous ones until exhausted. Difference, in this case, is of course debatable )

However, the problem is that in about 1 in 8 tries(more in the full version where I iterate over the whole 1024 lists). I get an error that the generated list does not correspond to any of the lists in the ~listmeta.

I tried to localize the problem by using this at multiple places

	if((~listmeta.select({arg itema, ia;
(itema.as(Set)).as(Array).sort == ([ "2 A", 1, "2 B" ].as(Set)).as(Array).sort })).size == (360 - (~metacontrast.size)), 
{nil},
{"what1".postln;~search.stop});

[ “2 A”, 1, “2 B” ] serves to filter out all the 360 lists out of 1024 in the main list. Which should
equal 360 - the lists added to the ~metacontrast and already removed from the ~listmeta

The problem seems to occur in this section of the code

{var num;	
	metapermutation.postln;
        //removing the metapattern from the main list
	num = ~listmeta.detectIndex({arg itemd, id; itemd == metapermutation});
        num.postln;
        ~listmeta.removeAt(num);
	indexlist.postln;
	//adding the metapattern to the meta path
       ~metacontrast = ~metacontrast.add(metapermutation.deepCopy);
	"what5".postln;
	if((~listmeta.select({arg itema, ia;(itema.as(Set)).as(Array).sort == ([ "2 A", 1, "2 B" ].as(Set)).as(Array).sort })).size == (360 - (~metacontrast.size)), {nil},{"what5".postln;~search.stop});
				});

I have found out that the both ~metacontrast.size and ~listmeta.size numbers are correct. Just that something has changed in the ~listmeta list and consequently found a NIL in place of one of the lists. However, its index was nowhere near the removed indexes. And since the error is reoccurring in the bit above I am at a loss what might be causing this.

Could it be some memory issue since the list is quite big or perhaps something dealing with a latency?

(I think there is an identical problem happening with the other big list used in the code, causing the “lastlist empty” message, but that one I have not investigated yet since it happens even more scarcely)

Thank you so much for reading through this and any thoughts !

the full code part 1:



(
//list of all the permutations of 5 numbers used and 4 kinds of numbers possible
~list1 = [[0,0,0,0,0],[0,0,0,0,1],[0,0,0,0,2],[0,0,0,0,3],[0,0,0,1,0],[0,0,0,1,1],[0,0,0,1,2],[0,0,0,1,3],[0,0,0,2,0],[0,0,0,2,1],[0,0,0,2,2],[0,0,0,2,3],[0,0,0,3,0],[0,0,0,3,1],[0,0,0,3,2],[0,0,0,3,3],[0,0,1,0,0],[0,0,1,0,1],[0,0,1,0,2],[0,0,1,0,3],[0,0,1,1,0],[0,0,1,1,1],[0,0,1,1,2],[0,0,1,1,3],[0,0,1,2,0],[0,0,1,2,1],[0,0,1,2,2],[0,0,1,2,3],[0,0,1,3,0],[0,0,1,3,1],[0,0,1,3,2],[0,0,1,3,3],[0,0,2,0,0],[0,0,2,0,1],[0,0,2,0,2],[0,0,2,0,3],[0,0,2,1,0],[0,0,2,1,1],[0,0,2,1,2],[0,0,2,1,3],[0,0,2,2,0],[0,0,2,2,1],[0,0,2,2,2],[0,0,2,2,3],[0,0,2,3,0],[0,0,2,3,1],[0,0,2,3,2],[0,0,2,3,3],[0,0,3,0,0],[0,0,3,0,1],[0,0,3,0,2],[0,0,3,0,3],[0,0,3,1,0],[0,0,3,1,1],[0,0,3,1,2],[0,0,3,1,3],[0,0,3,2,0],[0,0,3,2,1],[0,0,3,2,2],[0,0,3,2,3],[0,0,3,3,0],[0,0,3,3,1],[0,0,3,3,2],[0,0,3,3,3],[0,1,0,0,0],[0,1,0,0,1],[0,1,0,0,2],[0,1,0,0,3],[0,1,0,1,0],[0,1,0,1,1],[0,1,0,1,2],[0,1,0,1,3],[0,1,0,2,0],[0,1,0,2,1],[0,1,0,2,2],[0,1,0,2,3],[0,1,0,3,0],[0,1,0,3,1],[0,1,0,3,2],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],[3,3,3,0,2],[3,3,3,0,3],[3,3,3,1,0],[3,3,3,1,1],[3,3,3,1,2],[3,3,3,1,3],[3,3,3,2,0],[3,3,3,2,1],[3,3,3,2,2],[3,3,3,2,3],[3,3,3,3,0],[3,3,3,3,1],[3,3,3,3,2],[3,3,3,3,3]];

part 2


//the same list with converted numbers into number of occurences. (With the same amount of occurences for two numbers "A" and "B" is assigned.)
~listmeta= [ [ 5, 5, 5, 5, 5 ], [ 4, 4, 4, 4, 1 ], [ 4, 4, 4, 4, 1 ], [ 4, 4, 4, 4, 1 ], [ 4, 4, 4, 1, 4 ], [ 3, 3, 3, 2, 2 ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, "1 A", "1 B" ], [ 4, 4, 4, 1, 4 ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, 2, 2 ], [ 3, 3, 3, "1 A", "1 B" ], [ 4, 4, 4, 1, 4 ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, 2, 2 ], [ 4, 4, 1, 4, 4 ], [ 3, 3, 2, 3, 2 ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, 2, 2, 3 ], [ 2, 2, 3, 3, 3 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 3, 3, "1 A", "1 B", 3 ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, "1 A", "1 B", 3 ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 2, 2, "1 A", "1 B", "1 C" ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 4, 4, 1, 4, 4 ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, 2, 3, 2 ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, 2, 2, 3 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 2, 2, 3, 3, 3 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 3, 3, "1 A", "1 B", 3 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 4, 4, 1, 4, 4 ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, 2, 3, 2 ], [ 3, 3, "1 A", "1 B", 3 ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 2, 2, "1 A", "1 B", "1 C" ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 3, 3, 2, 2, 3 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 2, 2, 3, 3, 3 ], [ 4, 1, 4, 4, 4 ], [ 3, 2, 3, 3, 2 ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, 2, 3, 2, 3 ], [ 2, 3, 2, 3, 3 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ 3, "1 A", 3, "1 B", 3 ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, "1 A", 3, "1 B", 3 ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 2, "1 A", 2, "1 B", "1 C" ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ 3, 2, 2, 3, 3 ], [ 2, 3, 3, 2, 3 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ 2, 3, 3, 3, 2 ], [ 1, 4, 4, 4, 4 ], [ "1 A", 3, 3, 3, "1 B" ], [ "1 A", 3, 3, 3, "1 B" ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 3, 3, "1 B", 3 ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 3, 3, "1 B", 3 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ 3, "1 A", "1 B", 3, 3 ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ "1 A", 3, "1 B", 3, 3 ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 3, 3, 3 ], [ "1 A", "1 B", 2, 2, "1 C" ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ 3, "1 A", "1 B", 3, 3 ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ "1 A", 3, "1 B", 3, 3 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "1 A", "1 B", 3, 3, 3 ], [ 4, 1, 4, 4, 4 ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, 2, 3, 3, 2 ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, "1 A", 3, "1 B", 3 ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, 2, 3, 2, 3 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ 2, 3, 2, 3, 3 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ 3, "1 A", 3, "1 B", 3 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ 3, "1 A", "1 B", 3, 3 ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 3, 3, 3 ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "1 A", 3, "1 B", 3, 3 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ 3, 2, 2, 3, 3 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ 2, 3, 3, 2, 3 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "1 A", 3, 3, "1 B", 3 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ 2, 3, 3, 3, 2 ], [ "1 A", 3, 3, 3, "1 B" ], [ 1, 4, 4, 4, 4 ], [ "1 A", 3, 3, 3, "1 B" ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "1 A", 3, 3, "1 B", 3 ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ 3, "1 A", "1 B", 3, 3 ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "1 A", 3, "1 B", 3, 3 ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 3, 3, 3 ], [ 4, 1, 4, 4, 4 ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, 2, 3, 3, 2 ], [ 3, "1 A", 3, "1 B", 3 ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ 2, "1 A", 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 3, "1 A", 3, "1 B", 3 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 3, 2, 3, 2, 3 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ 2, 3, 2, 3, 3 ], [ 3, "1 A", "1 B", 3, 3 ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 3, 3, 3 ], [ "1 A", "1 B", 2, 2, "1 C" ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "1 A", 3, "1 B", 3, 3 ], [ 3, "1 A", "1 B", 3, 3 ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "1 A", "1 B", 3, 3, 3 ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ "1 A", 2, "1 B", 2, "1 C" ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "1 A", 3, "1 B", 3, 3 ], [ 3, 2, 2, 3, 3 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ 2, 3, 3, 2, 3 ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "1 A", 3, 3, "1 B", 3 ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 2, 2, "1 B", "1 C" ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "1 A", 3, 3, "1 B", 3 ], [ 2, 3, 3, 3, 2 ], [ "1 A", 3, 3, 3, "1 B" ], [ "1 A", 3, 3, 3, "1 B" ], [ 1, 4, 4, 4, 4 ], [ 1, 4, 4, 4, 4 ], [ 2, 3, 3, 3, 2 ], [ "1 A", 3, 3, 3, "1 B" ], [ "1 A", 3, 3, 3, "1 B" ], [ 2, 3, 3, 2, 3 ], [ 3, 2, 2, 3, 3 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ "1 A", 3, 3, "1 B", 3 ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "1 A", 3, 3, "1 B", 3 ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 2, 2, "1 B", "1 C" ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ 2, 3, 2, 3, 3 ], [ 3, 2, 3, 2, 3 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ 3, 2, 3, 3, 2 ], [ 4, 1, 4, 4, 4 ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, "1 A", 3, 3, "1 B" ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 3, "1 A", 3, "1 B", 3 ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ 2, "1 A", 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 3, "1 A", 3, "1 B", 3 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ "1 A", 3, "1 B", 3, 3 ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ 3, "1 A", "1 B", 3, 3 ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 3, 3, 3 ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "1 A", 2, "1 B", "1 C", 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", 3, "1 B", 3, 3 ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ "1 A", 2, "1 B", 2, "1 C" ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ 3, "1 A", "1 B", 3, 3 ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ "1 A", 2, "1 B", "1 C", 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "1 A", "1 B", 3, 3, 3 ], [ 2, 2, 3, 3, 3 ], [ 3, 3, 2, 2, 3 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 3, 3, 2, 3, 2 ], [ 4, 4, 1, 4, 4 ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, "1 A", 3, "1 B" ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 2, 2, "1 A", "1 B", "1 C" ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 3, 3, 3, 2, 2 ], [ 4, 4, 4, 1, 4 ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, "1 A", "1 B" ], [ 4, 4, 4, 4, 1 ], [ 5, 5, 5, 5, 5 ], [ 4, 4, 4, 4, 1 ], [ 4, 4, 4, 4, 1 ], [ 3, 3, 3, "1 A", "1 B" ], [ 4, 4, 4, 1, 4 ], [ 3, 3, 3, 2, 2 ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, "1 A", "1 B" ], [ 4, 4, 4, 1, 4 ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, 2, 2 ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, "1 A", 3, "1 B" ], [ 4, 4, 1, 4, 4 ], [ 3, 3, 2, 3, 2 ], [ 3, 3, "1 A", 3, "1 B" ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 3, 3, 2, 2, 3 ], [ 2, 2, 3, 3, 3 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, "1 A", "1 B", 3 ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 3, 3, "1 A", 3, "1 B" ], [ 4, 4, 1, 4, 4 ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, 2, 3, 2 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, "1 A", "1 B", 3 ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 3, 3, 2, 2, 3 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 2, 2, 3, 3, 3 ], [ "1 A", "1 B", 3, 3, 3 ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ 3, "1 A", "1 B", 3, 3 ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ "1 A", 3, "1 B", 3, 3 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "1 A", "1 B", 2, "1 C", 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ 3, "1 A", 3, "1 B", 3 ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, "1 A", 3, 3, "1 B" ], [ 4, 1, 4, 4, 4 ], [ 3, 2, 3, 3, 2 ], [ 3, "1 A", 3, 3, "1 B" ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ 3, 2, 3, 2, 3 ], [ 2, 3, 2, 3, 3 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, "1 A", 3, "1 B", 3 ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 3, 3, "1 B", 3 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ 3, 2, 2, 3, 3 ], [ 2, 3, 3, 2, 3 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ "1 A", 3, 3, 3, "1 B" ], [ 2, 3, 3, 3, 2 ], [ 1, 4, 4, 4, 4 ], [ "1 A", 3, 3, 3, "1 B" ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 3, 3, "1 B", 3 ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "1 A", "1 B", "1 C", 2, 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ 2, "1 A", "1 B", 2, "1 C" ], [ 3, "1 A", "1 B", 3, 3 ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ "1 A", 3, "1 B", 3, 3 ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 3, 3, 3 ], [ "1 A", "1 B", 3, 3, 3 ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ 3, "1 A", "1 B", 3, 3 ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ "1 A", "1 B", 2, "1 C", 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "1 A", 3, "1 B", 3, 3 ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ 3, "1 A", 3, "1 B", 3 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 3, "1 A", 3, 3, "1 B" ], [ 4, 1, 4, 4, 4 ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, 2, 3, 3, 2 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, "1 A", 3, "1 B", 3 ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ 3, 2, 3, 2, 3 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ 2, 3, 2, 3, 3 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ 2, "1 A", "1 B", 2, "1 C" ], [ 3, "1 A", "1 B", 3, 3 ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 3, 3, 3 ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "1 A", 3, "1 B", 3, 3 ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "1 A", 3, 3, "1 B", 3 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ 3, 2, 2, 3, 3 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ 2, 3, 3, 2, 3 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "1 A", 3, 3, "1 B", 3 ], [ "1 A", 3, 3, 3, "1 B" ], [ 2, 3, 3, 3, 2 ], [ "1 A", 3, 3, 3, "1 B" ], [ 1, 4, 4, 4, 4 ], [ 1, 4, 4, 4, 4 ], [ "1 A", 3, 3, 3, "1 B" ], [ 2, 3, 3, 3, 2 ], [ "1 A", 3, 3, 3, "1 B" ], [ "1 A", 3, 3, "1 B", 3 ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 2, 2, "1 B", "1 C" ], [ 2, 3, 3, 2, 3 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ 3, 2, 2, 3, 3 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ "1 A", 3, 3, "1 B", 3 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "1 A", 3, "1 B", 3, 3 ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ "1 A", 2, "1 B", 2, "1 C" ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 3, 3, 3 ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ 3, "1 A", "1 B", 3, 3 ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ 2, 3, 2, 3, 3 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ 3, 2, 3, 2, 3 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ 3, "1 A", 3, "1 B", 3 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, 2, 3, 3, 2 ], [ 3, "1 A", 3, 3, "1 B" ], [ 4, 1, 4, 4, 4 ], [ 3, "1 A", 3, 3, "1 B" ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, "1 A", 3, "1 B", 3 ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ "1 A", 3, "1 B", 3, 3 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ 3, "1 A", "1 B", 3, 3 ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 3, 3, 3 ], [ "1 A", "1 B", 3, 3, 3 ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "1 A", 3, "1 B", 3, 3 ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ 3, "1 A", "1 B", 3, 3 ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "1 A", 3, 3, "1 B", 3 ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "1 A", 3, 3, 3, "1 B" ], [ 1, 4, 4, 4, 4 ], [ 2, 3, 3, 3, 2 ], [ "1 A", 3, 3, 3, "1 B" ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ 2, 3, 3, 2, 3 ], [ 3, 2, 2, 3, 3 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "1 A", 3, 3, "1 B", 3 ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 3, "1 A", 3, "1 B", 3 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ 2, 3, 2, 3, 3 ], [ 3, 2, 3, 2, 3 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, 2, 3, 3, 2 ], [ 4, 1, 4, 4, 4 ], [ 3, "1 A", 3, 3, "1 B" ], [ 2, "1 A", 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 3, "1 A", 3, "1 B", 3 ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "1 A", 3, "1 B", 3, 3 ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ 3, "1 A", "1 B", 3, 3 ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 3, 3, 3 ], [ 2, 2, 3, 3, 3 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 3, 3, 2, 2, 3 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, 2, 3, 2 ], [ 3, 3, "1 A", 3, "1 B" ], [ 4, 4, 1, 4, 4 ], [ 3, 3, "1 A", 3, "1 B" ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, "1 A", "1 B", 3 ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 2, 2, 3, 3, 3 ], [ 3, 3, 2, 2, 3 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, 2, 3, 2 ], [ 4, 4, 1, 4, 4 ], [ 3, 3, "1 A", 3, "1 B" ], [ 2, 2, "1 A", "1 B", "1 C" ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 3, 3, 3, 2, 2 ], [ 3, 3, 3, "1 A", "1 B" ], [ 4, 4, 4, 1, 4 ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, 2, 2 ], [ 4, 4, 4, 1, 4 ], [ 3, 3, 3, "1 A", "1 B" ], [ 4, 4, 4, 4, 1 ], [ 4, 4, 4, 4, 1 ], [ 5, 5, 5, 5, 5 ], [ 4, 4, 4, 4, 1 ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, "1 A", "1 B" ], [ 4, 4, 4, 1, 4 ], [ 3, 3, 3, 2, 2 ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, "1 A", "1 B", 3 ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 2, 2, "1 A", "1 B", "1 C" ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, "1 A", 3, "1 B" ], [ 4, 4, 1, 4, 4 ], [ 3, 3, 2, 3, 2 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 3, 3, 2, 2, 3 ], [ 2, 2, 3, 3, 3 ], [ "1 A", "1 B", 3, 3, 3 ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ 3, "1 A", "1 B", 3, 3 ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ "1 A", 3, "1 B", 3, 3 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "1 A", "1 B", 3, 3, 3 ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ 3, "1 A", "1 B", 3, 3 ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ "1 A", 2, "1 B", 2, "1 C" ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ "1 A", 3, "1 B", 3, 3 ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, "1 A", 3, "1 B", 3 ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 2, "1 A", 2, "1 B", "1 C" ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ 3, "1 A", 3, "1 B", 3 ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, "1 A", 3, 3, "1 B" ], [ 4, 1, 4, 4, 4 ], [ 3, 2, 3, 3, 2 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ 3, 2, 3, 2, 3 ], [ 2, 3, 2, 3, 3 ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 3, 3, "1 B", 3 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 3, 3, "1 B", 3 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ 3, 2, 2, 3, 3 ], [ 2, 3, 3, 2, 3 ], [ "1 A", 3, 3, 3, "1 B" ], [ "1 A", 3, 3, 3, "1 B" ], [ 2, 3, 3, 3, 2 ], [ 1, 4, 4, 4, 4 ], [ 1, 4, 4, 4, 4 ], [ "1 A", 3, 3, 3, "1 B" ], [ "1 A", 3, 3, 3, "1 B" ], [ 2, 3, 3, 3, 2 ], [ "1 A", 3, 3, "1 B", 3 ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 3, 3, "1 B", 3 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ 2, 3, 3, 2, 3 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ 3, 2, 2, 3, 3 ], [ "1 A", 3, "1 B", 3, 3 ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 3, 3, 3 ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ 3, "1 A", "1 B", 3, 3 ], [ "1 A", 3, "1 B", 3, 3 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "1 A", "1 B", 3, 3, 3 ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ 3, "1 A", "1 B", 3, 3 ], [ 2, 3, 2, 3, 3 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ 3, 2, 3, 2, 3 ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, "1 A", 3, "1 B", 3 ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 2, "1 A", 2, "1 B", "1 C" ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ 3, "1 A", 3, "1 B", 3 ], [ 3, 2, 3, 3, 2 ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, "1 A", 3, 3, "1 B" ], [ 4, 1, 4, 4, 4 ], [ "1 A", "1 B", 3, 3, 3 ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "1 A", 3, "1 B", 3, 3 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ 3, "1 A", "1 B", 3, 3 ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "1 A", 3, 3, "1 B", 3 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 3, 3, 3, "1 B" ], [ 1, 4, 4, 4, 4 ], [ "1 A", 3, 3, 3, "1 B" ], [ 2, 3, 3, 3, 2 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "1 A", 3, 3, "1 B", 3 ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ 2, 3, 3, 2, 3 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ 3, 2, 2, 3, 3 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "1 A", 3, "1 B", 3, 3 ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 3, 3, 3 ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ 3, "1 A", "1 B", 3, 3 ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, "1 A", 3, "1 B", 3 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ 2, 3, 2, 3, 3 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ 3, 2, 3, 2, 3 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ 3, "1 A", 3, "1 B", 3 ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, 2, 3, 3, 2 ], [ 3, "1 A", 3, 3, "1 B" ], [ 4, 1, 4, 4, 4 ], [ "1 A", "1 B", 3, 3, 3 ], [ "1 A", "1 B", 2, 2, "1 C" ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "1 A", 3, "1 B", 3, 3 ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ 3, "1 A", "1 B", 3, 3 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "1 A", "1 B", 3, 3, 3 ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", 2, "1 B", 2, "1 C" ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "1 A", 3, "1 B", 3, 3 ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ 3, "1 A", "1 B", 3, 3 ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "1 A", 3, 3, "1 B", 3 ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 2, 2, "1 B", "1 C" ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "1 A", 3, 3, "1 B", 3 ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 3, 3, 3, "1 B" ], [ "1 A", 3, 3, 3, "1 B" ], [ 1, 4, 4, 4, 4 ], [ 2, 3, 3, 3, 2 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ 2, 3, 3, 2, 3 ], [ 3, 2, 2, 3, 3 ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ 2, "1 A", 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 3, "1 A", 3, "1 B", 3 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 3, "1 A", 3, "1 B", 3 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ 2, 3, 2, 3, 3 ], [ 3, 2, 3, 2, 3 ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, 2, 3, 3, 2 ], [ 4, 1, 4, 4, 4 ], [ 2, 2, 3, 3, 3 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 3, 3, 2, 2, 3 ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, "1 A", "1 B", 3 ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 2, 2, "1 A", "1 B", "1 C" ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ 3, 3, 2, 3, 2 ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, "1 A", 3, "1 B" ], [ 4, 4, 1, 4, 4 ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, "1 A", "1 B", 3 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 2, 2, 3, 3, 3 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 3, 3, 2, 2, 3 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, 2, 3, 2 ], [ 3, 3, "1 A", 3, "1 B" ], [ 4, 4, 1, 4, 4 ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 2, 2, "1 A", "1 B", "1 C" ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 2, 2, 3, 3, 3 ], [ 3, 3, 2, 2, 3 ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, 2, 3, 2 ], [ 4, 4, 1, 4, 4 ], [ 3, 3, 3, 2, 2 ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, "1 A", "1 B" ], [ 4, 4, 4, 1, 4 ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, 2, 2 ], [ 3, 3, 3, "1 A", "1 B" ], [ 4, 4, 4, 1, 4 ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, 2, 2 ], [ 4, 4, 4, 1, 4 ], [ 4, 4, 4, 4, 1 ], [ 4, 4, 4, 4, 1 ], [ 4, 4, 4, 4, 1 ], [ 5, 5, 5, 5, 5 ] ])

part 3


(
//number of occurences of a number in the permutation
~newmeta = [0,1,2,2];

//minIndex that instead of choosing the first number chooses randomly
~minIndex = {arg list;var test = [], minx;
			minx = list.minItem;
			list.do{arg itm, indx; if(itm != minx, {nil},{test = test.add(indx)})};
	test.choose;};

//add preference to the number that was not used in previous permutations. If there are no options it uses any
~minIndexplus = {arg list;var test = [], minx, test2;
			minx = list.minItem;
			list.do{arg itm, indx; if(itm != minx, {nil},{test = test.add(indx)})};
	test2 = test.sect(~numbrlist);
	if(test2.size == 0, {test.choose},{test2.choose});
	};

//path of the chosen permutations
~contrastlist = [];

//removed permutations
~removed = [];

//path of the chosen "metapermutations"
~metacontrast = [];

~newpermutation = [nil,nil,nil,nil,nil];

//works with the minIndexplus func
~numbrlist =  [0,1,2,3];


//occurence of the number as rows and indexes as columns.
~metachart = Array2D.fromArray(5,5,Array.fill(100,0));
//kinds of numbers as rows and indexes as columns.
~instancechart = Array2D.fromArray(4,5,Array.fill(100,0));
)


//start the routine
(
~search = Routine({
while({~list1.size > 0},{

	//remove used numbers from the previous permutation from the list if there wont be any numbers left fill the list again
		if(~newpermutation[0] == nil, {nil},{
	~numbrlist = if(~numbrlist.difference(((~newpermutation.as(Set)).as(Array))) == [],
	{~numbrlist = [0,1,2,3].difference(((~newpermutation.as(Set)).as(Array)))},
				{~numbrlist = ~numbrlist.difference(((~newpermutation.as(Set)).as(Array)))});});

	//~numbrlist.postln;
	~newpermutation = [nil,nil,nil,nil,nil];

		~sort = {var pass = nil, indexinstance,indexlist = [[],[],[],[]], distancelist = [9999,9999,9999,9999], numberlist = [9999,9999,9999,9999],  newpermutation, distancelist2 = [9999,9999,9999,9999], numberlist2 = [9999,9999,9999,9999],instancelistcopy2, indexinstance2,first_run, metapermutation = [nil,nil,nil,nil,nil],duplicate2 = [0,0,0,0],oldminx = [0,0,0,0], occurrencelist = [] ;


		//////////////////////////////////////////////////////////////////////////////////////////////////////////////
		//this part takes the least used indexes from the ~metachart and puts the number of the indexes into the ---- indexlist to be used later

		indexinstance = Array.fill(4,{arg i; i = Array.fill(4,{arg ic; ic = 0})});

		//~instancechart.postln;
		//~metachart.postln;
		//("indexinstance:" +indexinstance).postln;
		//("indexlist:" +indexlist).postln;

		~newmeta.do({arg item, i; var list = [], count = 0, duplicate;

		//if((~listmeta.select({arg itema, ia;(itema.as(Set)).as(Array).sort == ([ "2 A", 1, "2 B" ].as(Set)).as(Array).sort })).size == (360 - (~metacontrast.size)), {nil},//{"what3".postln;~search.stop});


		if(item == 0, {nil},{

		~metachart.colsDo({arg itemc, ic; list = list.insert(ic,(~metachart.at(item - 1,ic)))});
		duplicate = list.deepCopy;
		duplicate2 = duplicate2.put(i,list.deepCopy);
		//("duplicate"+duplicate).postln;
		//duplicate2.postln;

		//~newpermutation.do({arg itemc ,ic; if(itemc != nil,{duplicate.put(ic,999999999)},{nil})});
		//indexlist[i - 1].do({arg itemc ,ic; duplicate.put(itemc, 999999999)});
					indexlist.do({arg itemc ,ic;
						indexlist[ic].do({arg itemx, ix;
						duplicate.put(itemx, 999999999)});
						});

		//("duplicate"+duplicate).postln;
0.001.wait;
		//inserts as many indexes needed for the metapattern
		while({count != item},{var minindex;
		minindex = ~minIndex.value(duplicate);
		0.001.wait;
		oldminx[i] = oldminx[i] + duplicate.minItem;
		indexlist[i] = indexlist[i].insert(count,minindex);
		duplicate.put(minindex,9999999);
		count = count + 1;
		});

		//puts occurences of the number into correct indexes of permutation
		indexlist[i].do({arg itemc, ic;
				metapermutation.put(itemc,item)
		});

		if(~newmeta.occurrencesOf(item) == 1, {},{

				occurrencelist = occurrencelist.add(i);
		});


		})
			});

		///////////////////////////////////////////
		//adding letters to the metapermutation if needed [0,1,2,2], [1,1,1,2], [0,1,1,3]

		//metapermutation.postln;

		if(((~newmeta == [0,1,2,2]) || (~newmeta == [1,1,1,2]) || (~newmeta == [0,1,1,3])) == false , {},{ var  list2 = [], varr, indexnumber = [], bool;


		list2 = occurrencelist.collect({arg item, i; indexlist[item] });

		//list2.postln;

		varr = (list2.flatten).minItem;

	(indexlist.do({arg item, i; if(item.includes(varr),{indexnumber = indexnumber.add(i); },{nil}) }));


		(list2.do({arg item, i; if(item.includes(varr),{list2.remove(item)},{nil}) }));

		varr = (list2.flatten).minItem;

		(indexlist.do({arg item, i; if(item.includes(varr),{indexnumber = indexnumber.add(i) },{nil}) }));



		if(list2.size == 1, {nil},{

			(list2.do({arg item, i; if(item.includes(varr),{list2.remove(item)},{nil}) }));

			varr = (list2.flatten).minItem;

			(indexlist.do({arg item, i; if(item.includes(varr),{indexnumber = indexnumber.add(i) },{nil}) }));

		bool = true

		});

	//indexnumber.postln;
	//~indexlist.postln;
	//metapermutation.postln;

		indexlist[indexnumber[0]].do({arg itemc, ic;
			metapermutation.put(itemc, metapermutation.at(itemc) + "A")
		});

		indexlist[indexnumber[1]].do({arg itemc, ic;
			metapermutation.put(itemc,metapermutation.at(itemc) + "B")
		});

	if(bool != true, {nil},{
		indexlist[indexnumber[2]].do({arg itemc, ic;
					metapermutation.put(itemc, metapermutation.at(itemc) + "C")

		})
			})
	});

		///////////////////////////////////////////

	//indexlist.postln;
	metapermutation.postln;

				//if((~listmeta.select({arg itema, ia;(itema.as(Set)).as(Array).sort == ([ "2 A", 1, "2 B" ].as(Set)).as(Array).sort })).size == (360 - (~metacontrast.size)), {nil},{"what0".postln;~search.stop});

	//0.1.wait;
			/////////////////////////////////////////////////////////////
			//check if this meta pattern is exhausted from the main list
				if(~listmeta.detect({arg item, i; item == metapermutation}) == nil,
				{var list, totaldistancelist = [],lastlist;
				//if it is

				//("metapermutation not in list" + metapermutation).postln;


				//get only metapermutations from the main list of the used metapattern
				lastlist = (~listmeta.select({arg itema, ia;
					(itema.as(Set)).as(Array).sort == (metapermutation.as(Set)).as(Array).sort })).deepCopy;

				0.001.wait;


				//calculated total distance of each metapermutation from the repeated metapermutation
				lastlist.do({arg item, i; var count;
									count = 0;
									~newmeta.do({arg itema, ia;
										if(itema == 0, {nil},{var min = 0;

								//("lastlist" + item).postln;
								//("duplicate2" + duplicate2).postln;
								item.do({arg itemb, ib;
									if(itemb == itema, {min = min + duplicate2[ia][ib]},{nil})
								});
								//("min"+ min).postln;
								//("oldminx"+ oldminx).postln;
								count = count + (min - oldminx[ia]);

										})
									});
									totaldistancelist = totaldistancelist.insert(i,count);
								});

								//lastlist.postln;

								//totaldistancelist.postln;

								if(lastlist.size == 0, {
									"lastlist meta empty".postln;
									~search.stop;
								},{var num;
									//"compromise metapermutation".postln;
									metapermutation = (lastlist[(~minIndex.value(totaldistancelist))]).deepCopy;
							0.001.wait;
									//metapermutation.postln;

						metapermutation.postln;
					//replacement metapattern
						~metacontrast = ~metacontrast.add(metapermutation.deepCopy);

					//removing the metapattern from the main metapattern list
						num = ~listmeta.detectIndex({arg itemd, id; itemd == metapermutation});
						~listmeta.removeAt(num);

						indexlist = [[],[],[],[]];

						//putting numbers from the compromise metapermutation back into the indexlist
						{var lettercount = 0;
						~newmeta.do({arg itemd, id; var count = 0, index, list = ["A","B","C"];
							if(itemd == 0, {nil},{

							if(~newmeta.occurrencesOf(itemd) > 1, {
0.001.wait;
								while({count != itemd},{

								index = metapermutation.detectIndex({ arg itemb, ib; itemd + list[lettercount] == itemb });
								indexlist[id] = indexlist[id].insert(count,index);
								metapermutation.put(index,9999999);
								count = count + 1;
							});
							lettercount = lettercount + 1;

									},{
0.001.wait;
							while({count != itemd},{

								index = metapermutation.detectIndex({ arg itemb, ib; itemd == itemb });
								indexlist[id] = indexlist[id].insert(count,index);
								metapermutation.put(index,9999999);
								count = count + 1;
							})
									}
							)
						})
								});
									}.value;

				0.001.wait;
					});
					indexlist.postln;
				//	"what8".postln;
				//	if((~listmeta.select({arg itema, ia;(itema.as(Set)).as(Array).sort == ([ "2 A", 1, "2 B" ].as(Set)).as(Array).sort })).size == (360 - //(~metacontrast.size)), {nil},{"what8".postln;~search.stop});

			},{var num;	
					metapermutation.postln;
				//removing the metapattern from the main list
						num = ~listmeta.detectIndex({arg itemd, id; itemd == metapermutation});
					num.postln;
						~listmeta.removeAt(num);
						indexlist.postln;
				//adding the metapattern to the meta path
					~metacontrast = ~metacontrast.add(metapermutation.deepCopy);
					"what5".postln;
						if((~listmeta.select({arg itema, ia;(itema.as(Set)).as(Array).sort == ([ "2 A", 1, "2 B" ].as(Set)).as(Array).sort })).size == (360 - (~metacontrast.size)), {nil},{"what5".postln;~search.stop});
				});


		//checks if the amount of deleted metapermutations matches the amount of added ones to the path
			"what1".postln;
			if((~listmeta.select({arg itema, ia;(itema.as(Set)).as(Array).sort == ([ "2 A", 1, "2 B" ].as(Set)).as(Array).sort })).size == (360 - (~metacontrast.size)), {nil},{"what1".postln;~search.stop});
//100.wait;
			///////////////////////////////////////////////////////////////

		//updating meta chart
		~newmeta.do({arg item, i;
		indexlist[i].do({arg itemc, ic;
		~metachart.put(item - 1, itemc, ~metachart.at(item - 1, itemc) + 1);
		});
			});

		~newmeta.do({arg item, i; var list2 ,list3,  instance = nil;

		if(item == 0, {nil},{

		//	("indexes to be used for" + item + ":").postln;

		//indexlist[i].postln;

		list2 = Array.fill(4,{arg i; i = 0});

		//"passing each row in instancechart according to the picked indexes to look for the lowest number of instances in said index".postln;
		~instancechart.rowsDo({arg itemrow, irow;
				//("passing a row: " + irow).postln;
				indexlist[i].do({arg itemc, ic;
				list2[irow] = list2[irow] + ~instancechart.at(irow,itemc);
				indexinstance[i][irow] = indexinstance[i][irow] + ~instancechart.at(irow,itemc);
				//indexlist.postln;
				//list2.postln;
				//indexinstance.postln;
				})
			});

			list3 = list2.deepCopy;
			//"checking repetition".postln;
0.001.wait;
			//avoiding repetition of numbers
			while({pass != 1},{var minindex;
				//("numberlist"+~numbrlist).postln;
				minindex = ~minIndexplus.value(list3);
				0.001.wait;
				//("minindex"+ minindex).postln;
				//list3.postln;

				if(~newpermutation.matchItem(minindex),{list3.put(minindex,99999)},{pass = 1; instance = minindex});
				});

				pass = nil;

			//("picked number:" + (instance) + "for number of instances:" + item).postln;

			//putting numbers into newpermutation
			indexlist[i].do({arg itemc, ic;
				~newpermutation.put(itemc, instance)
			});




			});
			});


		//copy for the trying of all the combinations second phase
		instancelistcopy2 = indexinstance.deepCopy;
		indexinstance2 = indexinstance.deepCopy;

		// remove options to repeat numbers
		~newmeta.do({arg item, i;
			if(item == 0, {nil},{
				~newmeta.do({arg itemc, ic;
					if(itemc == 0, {nil},{
						indexinstance[i] = indexinstance[i].put(~newpermutation[indexlist[ic][0]],9999)
					})

				});
			})
		});

			//("indexlist: "+ indexlist).postln;
			//("indexinstance:"+indexinstance).postln;
			//("indexinstance2:"+indexinstance2).postln;



			//("distancelist:" + distancelist).postln;
			//("numberlist:" + numberlist).postln;



		//check if the generated permutation was not already exhausted
					if(~list1.detect({arg item, i; item == ~newpermutation}) == nil,
				{var list, lastlist, totaldistancelist = [];

					//("repeated permutation:" + ~newpermutation).postln;


////////////////////////////////////////////////// ///////////////////////////////////
								//all possible changes of numbers from the repeated permutation and its union with all the remaining permutations in the main list ~list1 and iterate over them
								//instancelistcopy2.postln;
								//indexinstance2.postln;
								//indexlist.postln;



								list = {var indlist = [], firstnumber, max, listt;

									max = ((~newpermutation.as(Set)).as(Array)).deepCopy;

									~newpermutation.do({arg itemx, ix; if(itemx == max[0], {indlist = indlist.add(ix)},{})});
									[0,1,2,3].do({arg itemb, ib; var list1, indlist2 = [];
									max = ((~newpermutation.as(Set)).as(Array)).deepCopy;
										//"level-one".postln;
										firstnumber = (~newpermutation.deepCopy).put(indlist,itemb);
										//firstnumber.postln;
										if(max.size <= 1, {listt = listt.add(firstnumber.deepCopy)},{
											max.removeAt(0);

											~newpermutation.do({arg itemx, ix; if(itemx == max[0], {indlist2 = indlist2.add(ix)},{})});
												//"level-two".postln;
												list1 = [0,1,2,3];
												list1.remove(itemb);
												//indlist2.postln;
												//list1.postln;
											list1.do({arg itemd, id; var firstnumber2, list2, indlist3 = [], max2;
												max2 = max.deepCopy;
												firstnumber2 =  (firstnumber.deepCopy).put(indlist2,itemd);
												//firstnumber2.postln;
												if(max2.size <= 1, {
													//firstnumber2.postln;
													listt =  listt.add(firstnumber2.deepCopy)},{

													max2.removeAt(0);

													~newpermutation.do({arg itemx, ix; if(itemx == max2[0], {indlist3 = indlist3.add(ix)},{})});
													//"level-three".postln;
													list2 = list1.deepCopy;
													list2.remove(itemd);
													//indlist3.postln;
													//list2.postln;
													list2.do({arg itemc, ic; var firstnumber3, list3, indlist4 = [], max3;
														max3 = max2.deepCopy;
														firstnumber3 =  (firstnumber2.deepCopy).put(indlist3,itemc);
														if(max3.size <= 1, {
															//firstnumber3.postln;
															listt =  listt.add(firstnumber3.deepCopy)},{

													max3.removeAt(0);

													~newpermutation.do({arg itemx, ix; if(itemx == max3[0], {indlist4 = indlist4.add(ix)},{})});
													//"level-four".postln;
													list3 = list2.deepCopy;
													list3.remove(itemc);
													//indlist4.postln;
													//list3.postln;
													list3.do({arg iteme, ie; var firstnumber4, max4;
														max4 = max3.deepCopy;
														firstnumber4 =  (firstnumber3.deepCopy).put(indlist4,iteme);
														if(max4.size <= 1, {
																	//firstnumber4.postln;
																	listt =  listt.add(firstnumber4.deepCopy)},{
																	"errorthis".postln;
													})
												})
											})
										})
											})
										})
										})
									});
									listt
								}.value;
						0.001.wait;

								//list.postln;
						("all possible"+(list.size)).postln;

					list.postcs;

				//checks for the biggest distance from the original generated permutation and picks the one with the lowest distance
								list.do({arg item, i; ~list1.do({arg itemb, ib; if(itemb == item,  {lastlist = lastlist.add(itemb.deepCopy)},{nil}) })});


								lastlist.do({arg item, i; var count;
									count = 0;
									~newmeta.do({arg itema, ia;
										if(itema == 0, {nil},{var oldmin, min;
											oldmin = indexinstance2[ia][~newpermutation[indexlist[ia][0]]];
											min = indexinstance2[ia][item[indexlist[ia][0]]];
											count = count + (min - oldmin);

										})
									});
									totaldistancelist = totaldistancelist.insert(i,count);
								});

								//lastlist.postln;

								//totaldistancelist.postln;

								if(lastlist.size == 0, {
									"lastlist empty".postln;
									~search.stop;
								},{
									//"compromise permutation".postln;
									~newpermutation = (lastlist[(~minIndex.value(totaldistancelist))]).deepCopy;
							0.001.wait;
									//~newpermutation.postln;
								});
			},{nil});

//////////////////////////////////////


		("new permutation:"+~newpermutation).postln;

		//update instance chart
		~newpermutation.do({arg item, i; ~instancechart.put(item, i, ~instancechart.at(item , i) + 1)});

		//~instancechart.postln;
		//~metachart.postln;

	}.value;

0.001.wait;

//remove from the original list and check if it is not repeated

		if(~list1.detect({arg item, i; item == ~newpermutation}) == nil,{"error".postln;~search.stop;},{var num, post; num = ~list1.detectIndex({ arg item, i; item == ~newpermutation});
				post = ~list1.removeAt(num);
			post.postln;
			~removed = ~removed.add(post);
				"removed".postln; });

//add to the full list
~contrastlist = ~contrastlist.add(~newpermutation);


if(~contrastlist.size == 360, {"finished".postln;~search.stop; },{nil});

//check if the amount of added permutations matches the added metapermutations
if(~contrastlist.size != ~metacontrast.size, {"not the same".postln;~search.stop; },{nil});

	})
}).play)

That is… wow… really a lot of code to absorb. I did take a look, but time doesn’t permit me to go in depth.

I’ll suggest, though, that re-factoring the code into smaller functions could help you find the bug.

One general suggestion that a lot of computer scientists make is that a single function should fit easily onto the screen, preferably 15-20 lines or fewer. Now, we break that guideline all the time – but a worthy ideal is to be able to read and understand the purpose of a function at a glance. If it’s a large and complex function, it should delegate parts of the process to other functions.

Your ~sort function by itself is 459 lines. That’s guaranteed to make it harder to understand and, since it’s impossible to run small pieces of the huge function in isolation, it’s hard to test the components individually. There is no advantage to doing it this way. (I have to admit here that I was just looking the other day at one of my functions that is a bit out of control, needs to be re-factored – but that’s “only” 128 lines…)

What if it’s like this instead?

~sort = {
	//this part takes the least used indexes from the ~metachart and puts the number of the indexes into the ---- indexlist to be used later
	leastUsedIndices = ~getLeastUsedIndices.value(... pass relevant data...);
	indexlist = ~putIntoIndexList.value(leastUsedIndices, indexlist);

	//adding letters to the metapermutation if needed [0,1,2,2], [1,1,1,2], [0,1,1,3]
	~addLettersToMetaPermutation.value(...);

	// ... etc. etc.
};

Each of these high-level parts of the algorithm should, in the main function, be represented by one or two lines of code ONLY.

With descriptive function names, then some of the comments could be removed as well, reducing visual noise.

This will take time, but it has the advantage that you will understand the code better, and it will be easier for others to approach it.

hjh

Hello James!

As always thank you for taking your time to reply I really appreciate it.

That’s a really great tip. I will try to go ahead and do that as well as keep that in mind for the future. Perhaps the solution will come forth afterwards!

However, maybe I did not make it clear enough in my question, but I did not expect anyone to go through the whole code, just the section, where the error occurs. I only included it so it would be possible to replicate the bug. (Although maybe my assumption, that the knowledge of the whole code is not necessary, is wrong )

I think it could have something to do with memory. Because if I try ~listmeta.detectIndex or ~listmeta.any… item == nil it does not detect anything even though ~listmeta.postcs prints the NIL out. Also sometimes many NIL’s appear at once and sometimes I get a NIL in a place of one of the numbers inside the ~listmeta lists. These could be multiple problems, but all of them are happening in the same place.

{var num;
metapermutation.postln;
//removing the metapattern from the main list
num = ~listmeta.detectIndex({arg itemd, id; itemd == metapermutation});
num.postln;
~listmeta.removeAt(num);
indexlist.postln;
//adding the metapattern to the meta path
~metacontrast = ~metacontrast.add(metapermutation.deepCopy);
“what5”.postln;
if((~listmeta.select({arg itema, ia;(itema.as(Set)).as(Array).sort == ([ “2 A”, 1, “2 B” ].as(Set)).as(Array).sort })).size == (360 - (~metacontrast.size)), {nil},{“what5”.postln;~search.stop});
});

Another bug that I just noticed in relation to this is that whenever the ~listmeta list is on the screen and I select and execute it, Supercollider crashes, but if I scroll down so it is not visible while still selected and execute it, it works fine.

First, you can replace the first two initialization code blocks, with their thousands of literals, with the following:

(
~list1 = [0, 1, 2, 3].dup(5).allTuples;

~listmeta = ~list1.collect { |row|
	var counts = Array.fill(4, 0), metacounts = Array.fill(6, 0), suffixes = Array.fill(6, 0);
	row.do { |val|
		counts[val] = counts[val] + 1;
	};
	counts.do { |val|
		metacounts[val] = metacounts[val] + 1;
	};
	Array.fill(5, { |i|
		if(metacounts[counts[row[i]]] > 1) {
			suffixes[counts[row[i]]] = suffixes[counts[row[i]]] + 1;
			counts[row[i]].asString + (suffixes[counts[row[i]]] + 64).asAscii
		} {
			counts[row[i]]
		}
	})
};
)

(I think…?)

Oddly enough, this executes faster than the very long compile strings. It’s definitely less load on the parser. (The crash you reported suggests that you’re hitting an upper limit on the editor’s tokenizer, which is responsible for syntax colorizing, indenting, and identifying code block boundaries.)

After that, I ran both “part 3” blocks and got an answer:

-> Array2D[ [ 0, 0, 0, 0, 0 ][ 0, 0, 0, 0, 0 ][ 0, 0, 0, 0, 0 ][ 0, 0, 0, 0, 0 ] ]
-> a Routine
[ 2 A, 1, 2 B, 2 B, 2 A ]
lastlist meta empty

This makes me think that your ~listmeta might have a mistake in it. When I use the very long listing, I get the error that you mentioned. When I use my algorithmically-constructed ~listmeta, no error. ([ 2 A, 1, 2 B, 2 B, 2 A ] looks strange to me, but I confirmed it doesn’t exist in the original ~listmeta… so… I’m out of ideas for now.)

Tbh I’m not clear what it’s supposed to do, so that last paragraph might be off base.

hjh

Ahh, I see! I somehow thought that providing a full list would be computationally cheaper!

This is the function I used to make the ~listmeta (it is unfortunately not as neat and compact)

~list1 = [0, 1, 2, 3].dup(5).allTuples;

~listmeta = ~list1.deepCopy;

~listmeta.do({arg item, i;

	if(((item.asSet).asArray).size > 2, {var list = [], count = 0, list2 = ["A","B","C"], list3 = [], one, two, itemlist= [];

		list = Array.fill(((item.asSet).asArray).size, {arg i; i = []});

		((item.asSet).asArray).do({arg itemx, ix; list3 = list3.add(item.occurrencesOf(itemx))});


		one =  list3.count({arg itemx, ix; itemx == 1});
		two =  list3.count({arg itemx, ix; itemx == 2});


		if(([one,two].maxIndex) == 0, {

			item.do({arg itemx, ix;

			if(item.occurrencesOf(itemx) > 1 ,{nil},{
				list[count] = list[count].add(ix);
				count = count + 1
				});
			})
		},{
			item.do({arg itemx, ix; var yes = 0;
				if(item.occurrencesOf(itemx)  < 2 ,{nil},{
				yes = list.detectIndex({arg itema, ia; itema.detectIndex({arg itemb, ib; item[itemb] == itemx}) != nil });

					if(yes == nil, {
					list[count] = list[count].add(ix);
					count = count + 1;
				},{
					list[yes] = list[yes].add(ix);
				})
				})
			})
		});


		~listmeta.put(i,(item.collect({arg itemx, ix; item.occurrencesOf(itemx)})););

		list.do({arg itema, ia; itema.do({arg itemb, ib; ~listmeta[i].put(itemb,  ~listmeta[i].at(itemb) + list2[ia] )})});

	},{
		~listmeta.put(i,(item.collect({arg itemx, ix; item.occurrencesOf(itemx)})););
	})
});)

If I understand correctly I have found that it is because your ~listmeta function created the list differently than it was intended (Apologies I have not really explained in the comments how it works)
I needed to distinguish between the same amount of occurrences of a number. Like this

[0,1,0,2,1] —> [2A,2B,2A,1,2B]
[0,1,0,3,2] ---- > [2,1A,2,1B,1C]

Because otherwise [0,1,0,2,1] and [1,0,0,2,1] would be both [2,2,2,1,2] and it was causing some problems.

Also [ 2 A, 1, 2 B, 2 B, 2 A ] exists in my list or well it exists there like this: [ “2 A”, 1, “2 B”, “2 B”, “2 A” ]

Otherwise declaring the lists this way really did the trick! I have tried to run the code for a good measure to see if anything changed. And I got to about 10 successful tries before the first error came up. It is probably a coincidence. But it got me thinking along the lines of my memory theory. Whether there might be some information accumulating and afterwards there is not enough memory for processing and error occurs.

Ah, I see, I did misunderstand the reason for the letters.

My other suggestion would be to use more temporary variables. For instance, at the start of the ~listmeta.do loop, you have (item.asSet).asArray three separate times. asSet creates a new object (and it’s using an array, so really, two objects), and then asArray is creating another array – but item is not changing here, so you’re tripling the load on the garbage collector. You could start the loop with var reduced = item.asSet.asArray or even write another function to compact it without using a temporary Set.

SC usually uses a couple hundred MB and modern systems typically have 4, 8 or 16 GB, so that seems unlikely.

I might almost suspect garbage collection, but when I perform, I’m going through temporary objects fairly rapidly (every Event is a temp object, and playing an event goes through dozens of temp objects, and there may be a few dozen events per second), and it’s stable for long periods of time (like, when I’m experimenting with sounds or material, I might have SC running continuously for 3 or 4 hours without resetting, no hint of GC crashes – so my experience hasn’t been that SC memory management is terribly unstable).

If you’re 100% certain of the logic in the Routine, then… I don’t know. It would help to post a concrete example where you can’t detect nil but nil is being posted. I feel a bit at a loss because I haven’t been able to reproduce the problem (I ran the routine with your listmeta and it didn’t die with nil…?), and I’m relying only on your verbal description of the issue (can’t see any hard data for myself).

I can try again later…?

Also maybe update your SC if it’s not very a recent version.

hjh

OK, like this – now listmeta == your big array.

(
~list1 = [0, 1, 2, 3].dup(5).allTuples;

~listmeta = ~list1.collect { |row|
	var counts = Array.fill(4, 0), metacounts = Array.fill(6, 0),
	suffixes = Array.fill(6, { Array.new }), suffixIndex;
	row.do { |val|
		counts[val] = counts[val] + 1;
	};
	counts.do { |val|
		metacounts[val] = metacounts[val] + 1;
	};
	Array.fill(5, { |i|
		var count = counts[row[i]];
		if(metacounts[count] > 1) {
			suffixIndex = suffixes[count].indexOf(row[i]);
			if(suffixIndex.isNil) {
				suffixIndex = suffixes[count].size;
				suffixes[count] = suffixes[count].add(row[i]);
			};
			count.asString + (suffixIndex + 65).asAscii
		} {
			count
		}
	})
};
)

After fixing that, then:

~search = Routine({
	... big routine
}).play;

... lots of output...

new permutation: [ 3, 2, 3, 1, 2 ]
[ 3, 2, 3, 1, 2 ]
removed
finished

No errors. So it must be something in your environment (I’ll guess older SC version maybe – I just confirmed, there are some array-related garbage collection bugfixes in 3.11 that are not in 3.10 – if you aren’t on 3.11, this might explain why you’re seeing weird behavior and I’m not).

hjh

I do have the version 3.11 although I am on windows so there might be some differences ?!

Alright so this time I changed the ~listmeta function to the one suggested by you. Avoiding the three extra (item.asSet).asArray. To be sure I had the task manager window open alongside. To see whether my computer might be running out of memory or processing power. Those turned out to be fine.

On the third try NIL appeared in the ~list1 so I suppose it is a identical problem, but I did not want to use that as an example since I have not investigated this one myself. And on the 6th try I get this as usual:

new permutation: [ 1, 2, 3, 1, 3 ]
[ 1, 2, 3, 1, 3 ]
removed
[ 2 A, 2 A, 2 B, 2 B, 1 ]
what0
what10
[ 2 A, 2 A, 2 B, 2 B, 1 ]
243
[ [  ], [ 4 ], [ 1, 0 ], [ 3, 2 ] ]
what5
what5

The permutations are generated randomly, but when it gets stopped it is always by this

if((~listmeta.select({arg itema, ia;(itema.as(Set)).as(Array).sort == ([ "2 A", 1, "2 B" ].as(Set)).as(Array).sort })).size == (360 - (~metacontrast.size)), {nil},{"what5".postln;~search.stop})

where it either stops or it crashes because the NIL appears in the one of the lists instead of in place of one of the lists.

Now when I do ~listmeta.postcs:

[ [ 5, 5, 5, 5, 5 ], [ 4, 4, 4, 4, 1 ], [ 4, 4, 4, 4, 1 ], [ 4, 4, 4, 4, 1 ], [ 4, 4, 4, 1, 4 ], [ 3, 3, 3, 2, 2 ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, "1 A", "1 B" ], [ 4, 4, 4, 1, 4 ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, 2, 2 ], [ 3, 3, 3, "1 A", "1 B" ], [ 4, 4, 4, 1, 4 ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, 2, 2 ], [ 4, 4, 1, 4, 4 ], [ 3, 3, 2, 3, 2 ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, 2, 2, 3 ], [ 2, 2, 3, 3, 3 ], [ 3, 3, "1 A", "1 B", 3 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, "1 A", "1 B", 3 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 4, 4, 1, 4, 4 ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, 2, 3, 2 ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, 2, 2, 3 ], [ 2, 2, 3, 3, 3 ], [ 3, 3, "1 A", "1 B", 3 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 4, 4, 1, 4, 4 ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, 2, 3, 2 ], [ 3, 3, "1 A", "1 B", 3 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, "1 A", "1 B", 3 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, 2, 2, 3 ], [ 2, 2, 3, 3, 3 ], [ 4, 1, 4, 4, 4 ], [ 3, 2, 3, 3, 2 ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, 2, 3, 2, 3 ], [ 2, 3, 2, 3, 3 ], [ 3, "1 A", 3, "1 B", 3 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, "1 A", 3, "1 B", 3 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, 2, 2, 3, 3 ], [ 2, 3, 3, 2, 3 ], [ 2, 3, 3, 3, 2 ], [ 1, 4, 4, 4, 4 ], [ "1 A", 3, 3, 3, "1 B" ], [ "1 A", 3, 3, 3, "1 B" ], [ "1 A", 3, 3, "1 B", 3 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "1 A", 3, 3, "1 B", 3 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ 3, "1 A", "1 B", 3, 3 ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "1 A", 3, "1 B", 3, 3 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "1 A", "1 B", 3, 3, 3 ], [ "1 A", "1 B", 2, 2, "1 C" ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ 3, "1 A", "1 B", 3, 3 ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "1 A", 3, "1 B", 3, 3 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "1 A", "1 B", 3, 3, 3 ], [ 4, 1, 4, 4, 4 ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, 2, 3, 3, 2 ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, "1 A", 3, "1 B", 3 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, 2, 3, 2, 3 ], [ 2, 3, 2, 3, 3 ], [ 3, "1 A", 3, "1 B", 3 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, "1 A", "1 B", 3, 3 ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "1 A", "1 B", 3, 3, 3 ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "1 A", 3, "1 B", 3, 3 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ 3, 2, 2, 3, 3 ], [ 2, 3, 3, 2, 3 ], [ "1 A", 3, 3, "1 B", 3 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ 2, 3, 3, 3, 2 ], [ "1 A", 3, 3, 3, "1 B" ], [ 1, 4, 4, 4, 4 ], [ "1 A", 3, 3, 3, "1 B" ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "1 A", 3, 3, "1 B", 3 ], [ 3, "1 A", "1 B", 3, 3 ], [ 2, "1 A", "1 B", 2, "1 C" ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "1 A", 3, "1 B", 3, 3 ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "1 A", "1 B", 3, 3, 3 ], [ 4, 1, 4, 4, 4 ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, 2, 3, 3, 2 ], [ 3, "1 A", 3, "1 B", 3 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, "1 A", 3, "1 B", 3 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, 2, 3, 2, 3 ], [ 2, 3, 2, 3, 3 ], [ 3, "1 A", "1 B", 3, 3 ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "1 A", "1 B", 3, 3, 3 ], [ "1 A", "1 B", 2, 2, "1 C" ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "1 A", 3, "1 B", 3, 3 ], [ 3, "1 A", "1 B", 3, 3 ], [ 2, "1 A", "1 B", 2, "1 C" ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "1 A", "1 B", 3, 3, 3 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "1 A", 3, "1 B", 3, 3 ], [ 3, 2, 2, 3, 3 ], [ 2, 3, 3, 2, 3 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "1 A", 3, 3, "1 B", 3 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "1 A", 3, 3, "1 B", 3 ], [ 2, 3, 3, 3, 2 ], [ "1 A", 3, 3, 3, "1 B" ], [ "1 A", 3, 3, 3, "1 B" ], [ 1, 4, 4, 4, 4 ], [ 1, 4, 4, 4, 4 ], [ 2, 3, 3, 3, 2 ], [ "1 A", 3, 3, 3, "1 B" ], [ "1 A", 3, 3, 3, "1 B" ], [ 2, 3, 3, 2, 3 ], [ 3, 2, 2, 3, 3 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ "1 A", 3, 3, "1 B", 3 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "1 A", 3, 3, "1 B", 3 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ 2, 3, 2, 3, 3 ], [ 3, 2, 3, 2, 3 ], [ 3, 2, 3, 3, 2 ], [ 4, 1, 4, 4, 4 ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, "1 A", 3, "1 B", 3 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, "1 A", 3, "1 B", 3 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ "1 A", 3, "1 B", 3, 3 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ 3, "1 A", "1 B", 3, 3 ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 3, 3, 3 ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "1 A", 2, "1 B", "1 C", 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", 3, "1 B", 3, 3 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ 3, "1 A", "1 B", 3, 3 ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "1 A", 2, "1 B", "1 C", 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "1 A", "1 B", 3, 3, 3 ], [ 2, 2, 3, 3, 3 ], [ 3, 3, 2, 2, 3 ], [ 3, 3, 2, 3, 2 ], [ 4, 4, 1, 4, 4 ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, "1 A", "1 B", 3 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, 3, 2, 2 ], [ 4, 4, 4, 1, 4 ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, "1 A", "1 B" ], [ 4, 4, 4, 4, 1 ], [ 5, 5, 5, 5, 5 ], [ 4, 4, 4, 4, 1 ], [ 4, 4, 4, 4, 1 ], [ 3, 3, 3, "1 A", "1 B" ], [ 4, 4, 4, 1, 4 ], [ 3, 3, 3, 2, 2 ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, "1 A", "1 B" ], [ 4, 4, 4, 1, 4 ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, 2, 2 ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, "1 A", 3, "1 B" ], [ 4, 4, 1, 4, 4 ], [ 3, 3, 2, 3, 2 ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, 2, 2, 3 ], [ 2, 2, 3, 3, 3 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, "1 A", "1 B", 3 ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, "1 A", 3, "1 B" ], [ 4, 4, 1, 4, 4 ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, 2, 3, 2 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, "1 A", "1 B", 3 ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 3, 3, 2, 2, 3 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 2, 2, 3, 3, 3 ], [ "1 A", "1 B", 3, 3, 3 ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ 3, "1 A", "1 B", 3, 3 ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "1 A", 3, "1 B", 3, 3 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "1 A", "1 B", 2, "1 C", 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ 3, "1 A", 3, "1 B", 3 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, "1 A", 3, 3, "1 B" ], [ 4, 1, 4, 4, 4 ], [ 3, 2, 3, 3, 2 ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, 2, 3, 2, 3 ], [ 2, 3, 2, 3, 3 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, "1 A", 3, "1 B", 3 ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 3, 3, "1 B", 3 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ 3, 2, 2, 3, 3 ], [ 2, 3, 3, 2, 3 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ "1 A", 3, 3, 3, "1 B" ], [ 2, 3, 3, 3, 2 ], [ 1, 4, 4, 4, 4 ], [ "1 A", 3, 3, 3, "1 B" ], [ "1 A", 2, 2, "1 B", "1 C" ], nil, [ "1 A", 3, 3, "1 B", 3 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ 2, "1 A", "1 B", 2, "1 C" ], [ 3, "1 A", "1 B", 3, 3 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "1 A", 3, "1 B", 3, 3 ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 3, 3, 3 ], [ "1 A", "1 B", 3, 3, 3 ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ 3, "1 A", "1 B", 3, 3 ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ "1 A", "1 B", 2, "1 C", 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "1 A", 3, "1 B", 3, 3 ], [ 3, "1 A", 3, "1 B", 3 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, "1 A", 3, 3, "1 B" ], [ 4, 1, 4, 4, 4 ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, 2, 3, 3, 2 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, "1 A", 3, "1 B", 3 ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ 3, 2, 3, 2, 3 ], [ 2, 3, 2, 3, 3 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ 2, "1 A", "1 B", 2, "1 C" ], [ 3, "1 A", "1 B", 3, 3 ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 3, 3, 3 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "1 A", 3, "1 B", 3, 3 ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "1 A", 3, 3, "1 B", 3 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ 3, 2, 2, 3, 3 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ 2, 3, 3, 2, 3 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "1 A", 3, 3, "1 B", 3 ], [ "1 A", 3, 3, 3, "1 B" ], [ 2, 3, 3, 3, 2 ], [ "1 A", 3, 3, 3, "1 B" ], [ 1, 4, 4, 4, 4 ], [ 1, 4, 4, 4, 4 ], [ "1 A", 3, 3, 3, "1 B" ], [ 2, 3, 3, 3, 2 ], [ "1 A", 3, 3, 3, "1 B" ], [ "1 A", 3, 3, "1 B", 3 ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 2, 2, "1 B", "1 C" ], [ 2, 3, 3, 2, 3 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ 3, 2, 2, 3, 3 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ "1 A", 3, 3, "1 B", 3 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "1 A", 3, "1 B", 3, 3 ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "1 A", 2, "1 B", 2, "1 C" ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 3, 3, 3 ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ 3, "1 A", "1 B", 3, 3 ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ 2, 3, 2, 3, 3 ], [ 3, 2, 3, 2, 3 ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ 3, "1 A", 3, "1 B", 3 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, 2, 3, 3, 2 ], [ 3, "1 A", 3, 3, "1 B" ], [ 4, 1, 4, 4, 4 ], [ 3, "1 A", 3, 3, "1 B" ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, "1 A", 3, "1 B", 3 ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ "1 A", 3, "1 B", 3, 3 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ 3, "1 A", "1 B", 3, 3 ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 3, 3, 3 ], [ "1 A", "1 B", 3, 3, 3 ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "1 A", 3, "1 B", 3, 3 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ 3, "1 A", "1 B", 3, 3 ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "1 A", 3, 3, "1 B", 3 ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "1 A", 3, 3, 3, "1 B" ], [ 1, 4, 4, 4, 4 ], [ 2, 3, 3, 3, 2 ], [ "1 A", 3, 3, 3, "1 B" ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ 2, 3, 3, 2, 3 ], [ 3, 2, 2, 3, 3 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "1 A", 3, 3, "1 B", 3 ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 3, "1 A", 3, "1 B", 3 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 2, 3, 2, 3, 3 ], [ 3, 2, 3, 2, 3 ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, 2, 3, 3, 2 ], [ 4, 1, 4, 4, 4 ], [ 3, "1 A", 3, 3, "1 B" ], [ 2, "1 A", 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 3, "1 A", 3, "1 B", 3 ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "1 A", 3, "1 B", 3, 3 ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ 3, "1 A", "1 B", 3, 3 ], [ "1 A", "1 B", 2, 2, "1 C" ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 3, 3, 3 ], [ 2, 2, 3, 3, 3 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 3, 3, 2, 2, 3 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, 2, 3, 2 ], [ 3, 3, "1 A", 3, "1 B" ], [ 4, 4, 1, 4, 4 ], [ 3, 3, "1 A", 3, "1 B" ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, "1 A", "1 B", 3 ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 2, 2, 3, 3, 3 ], [ 3, 3, 2, 2, 3 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, 2, 3, 2 ], [ 4, 4, 1, 4, 4 ], [ 3, 3, "1 A", 3, "1 B" ], [ 2, 2, "1 A", "1 B", "1 C" ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 3, 3, 3, 2, 2 ], [ 3, 3, 3, "1 A", "1 B" ], [ 4, 4, 4, 1, 4 ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, 2, 2 ], [ 4, 4, 4, 1, 4 ], [ 3, 3, 3, "1 A", "1 B" ], [ 4, 4, 4, 4, 1 ], [ 4, 4, 4, 4, 1 ], [ 5, 5, 5, 5, 5 ], [ 4, 4, 4, 4, 1 ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, "1 A", "1 B" ], [ 4, 4, 4, 1, 4 ], [ 3, 3, 3, 2, 2 ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, "1 A", "1 B", 3 ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 2, 2, "1 A", "1 B", "1 C" ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, "1 A", 3, "1 B" ], [ 4, 4, 1, 4, 4 ], [ 3, 3, 2, 3, 2 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 3, 3, 2, 2, 3 ], [ 2, 2, 3, 3, 3 ], [ "1 A", "1 B", 3, 3, 3 ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ 2, "1 A", "1 B", 2, "1 C" ], [ 3, "1 A", "1 B", 3, 3 ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ "1 A", 3, "1 B", 3, 3 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "1 A", "1 B", 3, 3, 3 ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ 3, "1 A", "1 B", 3, 3 ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ "1 A", 2, "1 B", 2, "1 C" ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ "1 A", 3, "1 B", 3, 3 ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, "1 A", 3, "1 B", 3 ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 2, "1 A", 2, "1 B", "1 C" ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ 3, "1 A", 3, "1 B", 3 ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, "1 A", 3, 3, "1 B" ], [ 4, 1, 4, 4, 4 ], [ 3, 2, 3, 3, 2 ], [ 3, 2, 3, 2, 3 ], [ 2, 3, 2, 3, 3 ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 3, 3, "1 B", 3 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 3, 3, "1 B", 3 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ 3, 2, 2, 3, 3 ], [ 2, 3, 3, 2, 3 ], [ "1 A", 3, 3, 3, "1 B" ], [ "1 A", 3, 3, 3, "1 B" ], [ 2, 3, 3, 3, 2 ], [ 1, 4, 4, 4, 4 ], [ 1, 4, 4, 4, 4 ], [ "1 A", 3, 3, 3, "1 B" ], [ "1 A", 3, 3, 3, "1 B" ], [ 2, 3, 3, 3, 2 ], [ "1 A", 3, 3, "1 B", 3 ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 3, 3, "1 B", 3 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ 2, 3, 3, 2, 3 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ 3, 2, 2, 3, 3 ], [ "1 A", 3, "1 B", 3, 3 ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 3, 3, 3 ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ 3, "1 A", "1 B", 3, 3 ], [ "1 A", 3, "1 B", 3, 3 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "1 A", "1 B", 3, 3, 3 ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ 3, "1 A", "1 B", 3, 3 ], [ 2, 3, 2, 3, 3 ], [ 3, 2, 3, 2, 3 ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, "1 A", 3, "1 B", 3 ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 2, "1 A", 2, "1 B", "1 C" ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ 3, "1 A", 3, "1 B", 3 ], [ 3, 2, 3, 3, 2 ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, "1 A", 3, 3, "1 B" ], [ 4, 1, 4, 4, 4 ], [ "1 A", "1 B", 3, 3, 3 ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "1 A", 3, "1 B", 3, 3 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ 3, "1 A", "1 B", 3, 3 ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "1 A", 3, 3, "1 B", 3 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 3, 3, 3, "1 B" ], [ 1, 4, 4, 4, 4 ], [ "1 A", 3, 3, 3, "1 B" ], [ 2, 3, 3, 3, 2 ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "1 A", 3, 3, "1 B", 3 ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ 2, 3, 3, 2, 3 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ 3, 2, 2, 3, 3 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "1 A", 3, "1 B", 3, 3 ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ "1 A", "1 B", 2, 2, "1 C" ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 3, 3, 3 ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ 3, "1 A", "1 B", 3, 3 ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 2, "1 A", 2, "1 B", "1 C" ], [ 3, "1 A", 3, "1 B", 3 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ 2, 3, 2, 3, 3 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ 3, 2, 3, 2, 3 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ 3, "1 A", 3, "1 B", 3 ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, 2, 3, 3, 2 ], [ 3, "1 A", 3, 3, "1 B" ], [ 4, 1, 4, 4, 4 ], [ "1 A", "1 B", 3, 3, 3 ], [ "1 A", "1 B", 2, 2, "1 C" ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "1 A", 2, "1 B", 2, "1 C" ], [ "1 A", 3, "1 B", 3, 3 ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ 3, "1 A", "1 B", 3, 3 ], [ "1 A", "1 B", "1 C", 2, 2 ], [ "1 A", "1 B", 2, "1 C", 2 ], [ "1 A", 2, "1 B", "1 C", 2 ], [ 2, "1 A", "1 B", "1 C", 2 ], [ "1 A", "1 B", 2, 2, "1 C" ], [ "1 A", "1 B", 3, 3, 3 ], [ 1, "2 A", "2 B", "2 B", "2 A" ], [ "2 A", 1, "2 B", "2 B", "2 A" ], [ "1 A", 2, "1 B", 2, "1 C" ], [ 1, "2 A", "2 B", "2 A", "2 B" ], [ "1 A", 3, "1 B", 3, 3 ], [ "2 A", "2 B", 1, "2 B", "2 A" ], [ 2, "1 A", "1 B", 2, "1 C" ], [ "2 A", 1, "2 B", "2 A", "2 B" ], [ "2 A", "2 B", 1, "2 A", "2 B" ], [ 3, "1 A", "1 B", 3, 3 ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "1 A", 2, 2, "1 B", "1 C" ], [ "1 A", 3, 3, "1 B", 3 ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 2, 2, "1 B", "1 C" ], [ 1, "2 A", "2 A", "2 B", "2 B" ], [ "1 A", 3, 3, "1 B", 3 ], [ "2 A", "2 B", "2 B", 1, "2 A" ], [ "1 A", 3, 3, 3, "1 B" ], [ "1 A", 3, 3, 3, "1 B" ], [ 1, 4, 4, 4, 4 ], [ 2, 3, 3, 3, 2 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ "2 A", "2 B", "2 B", "2 A", 1 ], [ 2, 3, 3, 2, 3 ], [ 3, 2, 2, 3, 3 ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ 2, "1 A", 2, "1 B", "1 C" ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 3, "1 A", 3, "1 B", 3 ], [ 2, "1 A", 2, "1 B", "1 C" ], [ "2 A", 1, "2 A", "2 B", "2 B" ], [ "2 A", "2 B", "2 A", 1, "2 B" ], [ 3, "1 A", 3, "1 B", 3 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ "2 A", "2 B", "2 A", "2 B", 1 ], [ 2, 3, 2, 3, 3 ], [ 3, 2, 3, 2, 3 ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, "1 A", 3, 3, "1 B" ], [ 3, 2, 3, 3, 2 ], [ 4, 1, 4, 4, 4 ], [ 2, 2, 3, 3, 3 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 3, 3, 2, 2, 3 ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, "1 A", "1 B", 3 ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 2, 2, "1 A", "1 B", "1 C" ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ 3, 3, 2, 3, 2 ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, "1 A", 3, "1 B" ], [ 4, 4, 1, 4, 4 ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 2, 2, "1 A", "1 B", "1 C" ], [ 3, 3, "1 A", "1 B", 3 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 2, 2, 3, 3, 3 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 3, 3, 2, 2, 3 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, 2, 3, 2 ], [ 3, 3, "1 A", 3, "1 B" ], [ 4, 4, 1, 4, 4 ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ 2, 2, "1 A", "1 B", "1 C" ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ 2, 2, "1 A", "1 B", "1 C" ], [ "2 A", "2 A", 1, "2 B", "2 B" ], [ "2 A", "2 A", "2 B", 1, "2 B" ], [ 3, 3, "1 A", "1 B", 3 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ "2 A", "2 A", "2 B", "2 B", 1 ], [ 2, 2, 3, 3, 3 ], [ 3, 3, 2, 2, 3 ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, "1 A", 3, "1 B" ], [ 3, 3, 2, 3, 2 ], [ 4, 4, 1, 4, 4 ], [ 3, 3, 3, 2, 2 ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, "1 A", "1 B" ], [ 4, 4, 4, 1, 4 ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, 2, 2 ], [ 3, 3, 3, "1 A", "1 B" ], [ 4, 4, 4, 1, 4 ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, "1 A", "1 B" ], [ 3, 3, 3, 2, 2 ], [ 4, 4, 4, 1, 4 ], [ 4, 4, 4, 4, 1 ], [ 4, 4, 4, 4, 1 ], [ 4, 4, 4, 4, 1 ], [ 5, 5, 5, 5, 5 ] ]

and with

~listmeta.any({arg item, i; item == nil})
false
~listmeta.detectIndex({arg item, i; item == nil})
nil

I have added the same function a bit above to narrow down what could be causing this

{var num;

					"what10".postln;
				if((~listmeta.select({arg itema, ia;(itema.as(Set)).as(Array).sort == ([ "2 A", 1, "2 B" ].as(Set)).as(Array).sort })).size == (360 - (~metacontrast.size)), {nil},{"what10".postln;~search.stop});
					metapermutation.postln;
				//removing the metapattern from the main list
						num = ~listmeta.detectIndex({arg itemd, id; itemd == metapermutation});
					num.postln;
					0.001.wait;
						~listmeta.removeAt(num);
						indexlist.postln;
				//adding the metapattern to the meta path
					~metacontrast = ~metacontrast.add(metapermutation.deepCopy);
					"what5".postln;
						if((~listmeta.select({arg itema, ia;(itema.as(Set)).as(Array).sort == ([ "2 A", 1, "2 B" ].as(Set)).as(Array).sort })).size == (360 - (~metacontrast.size)), {nil},{"what5".postln;~search.stop});
				});

So it narrowed it down to this part

	num = ~listmeta.detectIndex({arg itemd, id; itemd == metapermutation});
					num.postln;
					0.001.wait;
						~listmeta.removeAt(num);
						indexlist.postln;
				//adding the metapattern to the meta path
					~metacontrast = ~metacontrast.add(metapermutation.deepCopy);

I am not sure if I am however I looked at all the points of interaction with the ~listmeta where I might be creating some sort of link that I later remove and thus get a nil

So I rather turned this into a deepcopy

lastlist = (~listmeta.select({arg itema, ia;
					(itema.as(Set)).as(Array).sort == (metapermutation.as(Set)).as(Array).sort })).deepCopy;

not sure if this could somehow be causing any problems.

	if(~listmeta.detect({arg item, i; item == metapermutation}) == nil,

I have reinstalled supercollider just 2 days ago. But it is comforting to know that for you it runs just fine. My final goal with this code is to run it on RaspberryPi so maybe switching a platform could solve this.

I’m quite puzzled – I do see the nil in the posted output. If the searches for nil don’t find it, then there must be a discrepancy between the values being searched and those being posted… which should be impossible.

Does it post a nil if you do this?

~listmeta.do(_.postln);

This is to find out if postcs is getting confused from coping with a massive array – posting small pieces might behave differently. If nil is still printed, then I’d have more confidence that the printed output is correct (and somehow the search is touching the wrong data). If nil isn’t posted, then there’s a bug in postcs.

I’m pretty much out of ideas now, though…

hjh

Instead of the nil I get one of these (I tried it multiple times)

Frame (00000156E1411678) of ArrayedCollection:do
Frame (00000156E2C364E8) of True:&&
Frame (00000156E1380C78) of String:<=

Oh dear. That’s definitely a garbage collection bug.

Those are very hard to diagnose and fix. (They have also gotten harder to find, with gradual improvements over the years.)

If I have time later, I might try multiple runs, since you said it might not happen the first time.

Is there perhaps an alternate way to handle the cases where you’re now using deepCopy? I’m a bit suspicious of that.

hjh