how to compare two muti dimensional array in c#
for example public int[,] multidimasional1 array
public int[,] multidimasional2 array
in sliding how to use these two array whether the player has arranged the sliding puzzle in correct order like 1,2,3,4
5,6,7,8
9,10,.11,12
I assume they’re the same size; one is the correct version, the other is the user’s current version, yes?
Not sure whether there’s a better way than checking elements for equality.
bool IsPuzzleSolved() {
for (int x=0; x<width; x++) {
for (int y=0; y<height; y++) {
if (userArray[x,y] != solutionArray[x,y]) return false;
}
}
return true;
}