void init(void)
{
int start_tile = (d * d) - 1;
for (int i = 0; i < d; i++)
{
for (int j = 0; j < d; j++)
{
board[i][j] = start_tile;
start_tile--;
if ((d-1)% 2 != 0)
{
int swap = board[d-1][d-2];
board[d-1][d-2] = board[d-1][d-3];
board[d-1][d-3] = swap;
}
}
}
}
When board is drawn when d = 4, 6, or 8, the result appears like so (using 4 as an example):
15 14 13 12
11 10 9 8
7 6 5 4
3 _ 1 _
Tile to move:
Two questions: 1) What happened to the number 2? (2) Why is it looking at the array value [d - 1][d - 1]?