In the game of fifteen, I couldn't figure out a way to view the under-score sign "_" , I tried these lines of code: if (board[i][j] == 0) //checking if value is 0 to print a blank tile. these are the init and draw functions:
void init(void)
{
int i,j,start=0,temp=0;
if(d%2!=0){
start=d*d-1;
for (i=0; i<d;i++){ //the descending order appears only for the first rows
for (j=0; j<d;j++){
board[i][j]= start;
start-=1;
}
}
int a=d-1;
for(i=(d-1);i<=(d-1);i++){
for(j=0;j<d;j++){
board[i][j]=a;
a-=1;
}
}
}
else if(d%2==0){
start=d*d-1;
for (i=0; i<d;i++){
for (j=0; j<d;j++){
board[i][j]= start;
start-=1;
}
}
int b=d-1;
for(i=(d-1);i<=(d-1);i++){
for(j=0;j<d;j++){
board[i][j]=b;
b-=1;
}
}
temp=board[d-1][d-3] ;//switch 1 & 2, if d is even
board[d-1][d-3]=board[d-1][d-2];
board[d-1][d-2]=temp;
}}
void draw(void)
{
int i,j;
for (i=0; i<d;i++){ //the descending order appears only for the first rows
for (j=0; j<d;j++){
if (board[i][j] == 0) //checking if value is 0 to print a blank tile
printf(" _");
else
printf("%2d\t",board[i][j]);
}
printf("\n");
}}