I have been able to draw the board properly. I can locate the blank tile and tell when the blank tile is adjacent to the tile the user wants to move. My program warns the user when he/she selects a non-adjacent tile.
But I cannot figure out how to swap them once I know they are adjacent! Any hints or pseudocode would be much appreciated!!!!
If board is an array that stores the board's current configuration and board[tracki2][trackj2] contains the tile, and you need to swap it with board[tracki1][trackj1], then you can do it in this way.
int x = board[tracki1][trackj1];
board[tracki1][trackj1] = board[tracki2][trackj2];
board[tracki2][trackj2] = x;
x is declared int because we know that elements of board are integers.
Well in my case, I found it helpful not to keep track of the space but rather check if what the user chooses is next to the space....
if they choose a number in the corner, I check two sides, On the side, three sides, in the middle, four sides, then swap... Hope this helps :)