bool move(int tile)
{
int hold;
for(int i=0 ; i < d ; i++)
{
for(int j=0; j<d; j++)
{
if(board[i][j] == tile)
{
if(board[i-1][j] == symbol ||
board[i+1][j] == symbol ||
board[i][j+1] == symbol ||
board[i][j-1] == symbol )
{
printf("\n%d\n", tile);
hold = tile;
tile = symbol;
symbol = hold;
return true;
}
}
}
}
return false;
}
Its my code for move function... When I tried to move tile 1 which is beside to blank tile its showing illegal move... But when I checked it through gdb control is moving till the second if statement but it will not check all the 4 conditions what i mean is its coming out of the if loop returning false... I'm not understanding why it is happening?? Anybody Help me!!! Thanks in advance...