# fifteen , move function swaps wrong, anybody can spot the tiny error :)

Trying my hands on fifteen and i am a beginner. My move function sucessfully can tell if the tiles are next to each other. and the swap part should work in theory ( i know i can code it much shorter) Can anyone see why my swapping goes haywire?

bool move(int tile)
{
int swap=0;
int tilerow;
int tilecol;
int zerocol;
int zerorow;
for(int i=0;i<d;i++)
{
for (int j=0;j<d;j++)
{
if (board[i][j]==tile)
{
tilerow=i;
tilecol=j;
}
}
}
for(int i=0;i<d;i++)
{
for (int j=0;j<d;j++)
{
if (board[i][j]==0)
{
zerorow=i;
zerocol=j;
}
}
}
if(tilerow-zerorow==1 && tilecol-zerocol==0)
{
swap=board[tilecol][tilerow];
board[tilecol][tilerow]=board[zerocol][zerorow];
board[zerocol][zerorow]=swap;

return true;
}
else if(tilerow-zerorow==-1 && tilecol-zerocol==0)
{
swap=board[tilecol][tilerow];
board[tilecol][tilerow]=board[zerocol][zerorow];
board[zerocol][zerorow]=swap;
return true;
}
else if(tilerow-zerorow==0 && tilecol-zerocol==1)
{
swap=board[tilecol][tilerow];
board[tilecol][tilerow]=board[zerocol][zerorow];
board[zerocol][zerorow]=swap;
return true;
}
else if(tilerow-zerorow==0 && tilecol-zerocol==-1)
{
swap=board[tilecol][tilerow];
board[tilecol][tilerow]=board[zerocol][zerorow];
board[zerocol][zerorow]=swap;
return true;
}
else

return false;
return false;
}