I'm trying to come up with something to change the tile numbers in the last two array slots, containing numbers 1 and 2 when I have an odd number of tiles. I thought this would work, but when I print out the values using draw()
, it prints the 1 and 2 in the same place as it would if I had an even number of tiles. Here is my code:
void init(void)
{
int count=(d*d)-1;
for (int i=0; i<d;i++)
{
for (int j=0; j<d;j++)
{
board[i][j]=count;
count=count-1;
}
}
if ((d*d)%2==0)
{
board[d][d-2]=1;
board[d][d-1]=2;
// printf("odd %i %i \n", board[d][d-2], board[d][d-1]);
}
}
That print function was just there to see if the values were actually changing and that the if statement was recognizing an odd number of tiles, which it does! Still, it won't show up properly when I call draw()
.