#include <math.h>

char texture[4096];

void makeBoxes()
{
   // Not implemented yet   
}

void drawRandomRow(int row)
{
   int offset = row*64;
   int i;

   for(i=0;i < 63;i++)
   {
       char color = rand()%100;
       if(color < 50){
       texture[offset+i] = 1; 
}
      if((color > 50) && (color < 65))
{
       texture[offset+i] = 2; 
}      
      if((color > 65) && (color < 80))
{
       texture[offset+i] = 3; 
}      
      if((color > 80) && (color < 95))
{
       texture[offset+i] = 4; 
}      
      if((color > 95) && (color < 127))
{
       texture[offset+i] = 5; 
}      
      
   }
}

void drawRandomColumn(int column)
{
  ;
   int i;

   for(i=0;i < 63;i++)
   {
       char color = rand()%100;
       if(color < 50){
       texture[i*64+column] = 1; 
}
      if((color > 50) && (color < 65))
{
       texture[i*64+column] = 2; 
}      
      if((color > 65) && (color < 80))
{
       texture[i*64+column] = 3; 
}      
      if((color > 80) && (color < 95))
{
       texture[i*64+column] = 4; 
}      
      if((color > 95) && (color < 200))
{
       texture[i*64+column] = 5; 
}      
      
   }

}

void makeLines()
{
   // Check rows & columns

   int i;

   for(i=0;i<63;i++)
   {
      if(rand()%100 < 50)
      {
          drawRandomRow(i);
      }

      if(rand()%100 < 50)
      {
          drawRandomColumn(i);
      } 
   }  
}

void textureGen()
{
   int i;
   for(i=0;i<4095;i++)
   {
   texture[i] = 0;
   }
   makeBoxes();
   makeLines();
}


int main()
{
  textureGen();
  printf("%s.4096", texture); 
  return 0;
}
