I have a function createPattern, that, given an array, it returns a list of size 8 containing 7 symbols, say (1,2,3,4,5,6,7). Each symbol can either not appear at all in the list, or appear one or more times.
What i want to do is to create random arrays and, whenever a new pattern is found, append it to circ_pattern_Collection. The difficulty im having is with the following:
I want the code to recognize the pattern independent of the starting "symbol", i.e. recognize only the new circular patterns, for example:
(1,2,3,4,5,6,7,7) = (7,1,2,3,4,5,6,7) = (3,4,5,6,7,7,1,2)… and so on.
(1,1,1,2,3,3,3,3) = (1,1,2,3,3,3,3,1) = (3,3,3,3,1,1,1,2).. and so on.
Something like this :
circ_pattern_Collection=[]
for j in range(10000):
array = np.random.randint(-1000, 1000, (3, 3))
patternList = createPattern(array)
…
"if new circular pattern found, append to circ_pattern_Collection"
…
return circ_pattern_Collection
I could ofc do it by lots of if statements but there must be a more elegant/efficient way of doing this? Any tips?