In Game of Fifteen, I am able to store the positional indeces of the blank tile at init; I know the blank tile is the last one, therefore the position is board[y-1][x-1]. What I am struggling with is updating the y/x values once the game is afoot. Try as I might, I can only seem to retrieve the value of the element stored at any given position, not the indeces themslves.
In init, the following gives me the initial coordinates:
blankX = d-1;
blankY = d-1;
As I say, I can't track these coordinates at each subsequent draw, all my wildly ill-informed attempts at using pointers and so on yield nothing helpful, e.g.
if (board[row][col] == 99) // where 99 represents the blank tile
{
printf("| %c ", _blank_);
blankY = *board[row];
blankX = *board[col];
}
As far as I understand it and from what I can make out in gdb, I am merely assigning the first value in the row and column respectively.
Hopefully this is one of those 'Of course!!!' moments; I did read somewhere that it was easy to over think this one..