can anyone have better way to do this? or help to to tweak it, it looks inefficient.
public int getRow(int pos, State s) {
for(int i = 1; i <= 3; i++)
for(int j = 1; j <= 3; j++)
if(s.p[j] == pos)
return i;
return 0;
}
this actually is a 3X3 puzzle, i'm trying to get the row.
public int getRow(int pos, State s) {
for(int i = 1; i <= 3; i++)
for(int j = 1; j <= 3; j++)
if(s.p[j] == pos)
return i;
return 0;
}
this actually is a 3X3 puzzle, i'm trying to get the row.