#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define false 0
int main()
{
char in_box[10][10]={false};
int num1,num2,num=0;
int h=0,l=0,choice=0;
int i,j;
const char Alp[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M',
'N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
srand((unsigned) time(NULL));
h=rand()%10;
l=rand()%10;
in_box[h][l]=Alp[num];
num++;
while((num<26)&&(choice<4))
{
num1=rand()%4;
num2=rand()%4;
switch(choice)
{
case 0:
{
if((!in_box[h+num1][l])&&(h+num1)<10)
{
h+=num1;
in_box[h][l]=Alp[num];
num++;
choice=0;
//break;
}
else
choice++;
break;
}
case 1:
{
if((!in_box[h-num1][l])&&(h-num1)>=0)
{
h-=num1;
in_box[h][l]=Alp[num];
num++;
choice=0;
//break;
}
else
choice++;
break;
}
case 2:
{
if((!in_box[h][l+num1])&&(l+num1)<10)
{
l+=num1;
in_box[h][l]=Alp[num];
num++;
choice=0;
//break;
}
else
choice++;
break;
}
case 3:
{
if((!in_box[h][l-num1])&&(l-num1)>=0)
{
l-=num1;
in_box[h][l]=Alp[num];
num++;
choice=0;
//break;
}
else
choice++;
break;
}
}
}
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
if(!in_box[i][j])
//printf("%c",'.');
printf('.');
else
printf("%c",in_box[i][j]);
}
printf("\n");
}
return 0;
}
x (x)