so i have a series of 2x2 arrays that i want to compare edges for, example
So i want to compare all of the sides until i find the 2 that match.Code:char *tiles1[] = { "57", "24", "", "84", "57", ""
What is the best way to go about doing this?
so i have a series of 2x2 arrays that i want to compare edges for, example
So i want to compare all of the sides until i find the 2 that match.Code:char *tiles1[] = { "57", "24", "", "84", "57", ""
What is the best way to go about doing this?
You could look into using qsort(3) on your tiles. Even if you don't actually need to sort the tiles, one requirement of using that function is to design a COMPAR function which compares two elements of the type in question. In your case, two tiles should be considered equal if they have the same contents. In other words, you need to use strcmp pairwise on each item in the two tiles which are being compared.
i was thinking the easiest way to be to define a function that takes a tile and side number and returns the two numbers for that sidethat way you could loop over each edge in two tiles and compare each. But just wasnt sure the best way to go about it.