This is a large never ending project .. but a piece at this point is to:
currently I'm taking a random value from a text file.. There are 16 values grabbed and placed in a 2d array 4x4.
Currently I am storing statically through the below if/else statement. What I would like to do is randomly store those 16 values in a 2d array.
Code:
while(!feof(fid))
{
fscanf(fid, "%s", line);
printf("%s\n", line);
r = rand()%6;
c = line[r];
printf(" %c %d\n", c,r);
board[i][j]=c;
//****** insert values to board ******************
if (i==3)
{
i=0;
j++;
}
else
i++;
} // end while
// ************ output values of board ***************
for(i=0; i<4; i++)
{
for(j=0; j<4; j++)
{
printf("%c\n",board[j][i]);
}
}