Say I had the array:
int [] measurment = {1, 1, 9, 0, 7, 5, 1, 9, 8, 3, 3};
and the array:
int [] pattern = {3, 3};
I’m trying to get have my code find the pattern (3, 3) in the measurement array and then print out the location of the beginning of the pattern in the console. I’m also trying to get it to find the closest thing to the pattern if the pattern doesn’t exist. This is what I have so far:
void Start ()
{
int [] measurment = {1, 1, 9, 0, 7, 5, 1, 9, 8, 3, 3};
int [] pattern = {3, 3};
int [] patMatch;
for (int i = 0; i < pattern.length; i += 1){
for (int p = 0; p < measurment.length; p += 1){
if(pattern *== measurment[p]){*
-
for (int x = 0; x < pattern.length; x += 1){* -
if(pattern[x] == measurment[x + 1]){* -
//not sure what to do next* -
}* -
}* -
}* -
}* -
}* - }*
}