...#include <Turboc.h>
#define BW 4
#define BH 4
struct
{
bool ready;
bool pass;
int num;
int x,y;
}Board[BW][BH];
int setnum[17]={1,};
int main()
{
int i, j,temp;
for (i=0;i<BW;i++)
{
for (j=0;j<BH;j++)
{
temp=rand()%15+1;
for (;temp>0;temp--)
{
if (setnum[temp]==true)continue;
Board[i][j].num=temp; // Board[i][j].num=(temp>8?temp-8:temp); //숫자가 1~8이 두번반복
setnum[temp]=true;
break;
}
if (temp==0)
{
temp=1;
for (;temp<17;temp++)
{
if (setnum[temp]==true)continue;
Board[i][j].num=temp; // Board[i][j].num=(temp>8?temp-8:temp);
setnum[temp]=true;
break;
}
}
}
}
for (i=0;i<17 ;i++ )
{
printf("%d\n",setnum[i]);
}
for (i=0;i<BW;i++ )
{
for (j=0;j<BH;j++ )
{
printf("%d ",Board[i][j].num);
}
printf("\n");
}
}