# move function, pset3

I'm having trouble with my move funtion in the game of fifteen. For some reason the chosen tile and the adjecent zero won't swop places. I've been working on this function for too long and reaching out for help now. I eally hope somebody can help me out!

/** * If tile borders empty space, moves tile and returns true, else * returns false. */

bool move(int tile) { int temp;

``````if (tile == 0)
{
return false;
}
for (int row = 0; row < d; row++)
{
for (int column = 0; column < d; column++)
{
if (tile == board[row][column]) //checks array for tile
{

if (column > 0) //makes sure C does not acces any space to the left of 2D-array
{
if (board[row-0][column-1] == 0) // checks if blank space is left to tile
{
temp = tile;     //switch the tiles
board[row][column] = board[row-0][column-1];
board[row-0][column-1] = temp;
return true;
}
}
if (row > 0) //makes sure C does not access any space above 2D-array
{
if (board[row-1][column-0] == 0) // checks if blank space is above tile
{
temp = tile;     //switch the tiles
board[row][column] = board[row-1][column-0];
board[row-1][column-0] = temp;
return true;
}
}
if (column < d-1) //makes sure C does not access any space to the right of 2D-array
{
if (board[row+0][column+1] == 0) // checks if blank space is right to tile
{
temp = tile;     //switch the tiles
board[row][column] = board[row+0][column+1];
board[row+0][column+1] = temp;
printf("DEBUG: Do i move trough here?");
return true;
}
}
if (row < d-1) //makes sure C does not acces any space underneath 2D-array
{
if (board[row+1][column+0] == 0) // checks if blank space is underneath tile
{
temp = tile;     //switch the tiles
board[row][column] = board[row+1][column+0];
board[row+1][column+0] = temp;
return true;
}
}
}
}
}
return false;
``````

}