This is my move function for the Game of Fifteen. My board initialised okay but check50 is throwing errors at Move. For example:-
:( 3x3 board, move blank up twice \ expected "0" character 5 of line 6, not "3":( 3x3 board, move blank left twice
Also, should I break up the if statement? It seems ridiculously long. Is that bad form?
bool move(int tile)
{
//user has already given tile number but not the tile location.
//First find the tile location
for (int i=0;i<d;i++)// search board rows for users tile
{
for (int j=0;j<d;j++) //search columns
{
int blank = 0; //variable 0 = blankspace
if(tile==board[i][j])
{
int x=i; //row
int y=j; //column
if (((x==(i-1)) && (j==y)) || ((x==(i+1)) &&(j==y))|| ((i==x) && (y ==(j-1)))|| ((i==x) && (y==(j+1))))
{
board[x][y] = tile;
board[i][j] = blank;
return true;
}
}
}
}
return false;
}