// Title	: Examinar					
// Programmer	: Abdulla Al-mutawa						        
// Date Written	: 11/15/00					
// Purpose	: the examinar method will send the counter array which will 
//              : be examined here by scanning the block surrounding each 
//              : sample and determing if it satisfies the conditions, then 
//              : it send back the results which will be used by the builder 
//              : to construct the colors



class Examinar
   {
     int count,count2,count3,count4,switcher;
     int[][] xx = new int[14][14];    

   public int[][] Results (int[][] x)
     {
// transfering the valuse of our array to another , so when
// changes are made we wont loose the original conditions
        count = 0;
        while (count<14)
          {
            count2 = 0;
            while (count2<14)
              {
                xx[count][count2] = x[count][count2];
                count2 ++;
              }
                count ++;
          }

// the first two loops will take us to each item in the array
            count = 1;
            while (count<13)
              {
                count2 = 1;
                while (count2<13)
                  {
         
// then the block of items surrounding each individual item
// will be scanned by these two loops, the results are stored in switcher
                    switcher = 0;
                    count3   = count - 1;
                    while (count3<=(count+1))
                      {
                        count4 = count2 - 1;
                        while (count4<=(count2+1))
                          {
                             switcher = switcher + xx[count3][count4];
                             count4 ++;
                           }
                             count3 ++;
                      }

// according to the switcher , changes will be made to the array to 
// indicate life or death
            
                     if ((xx[count][count2] == 0)&&(switcher>2)) x[count][count2] = 1;

                     else if ((xx[count][count2] == 1)&&((switcher<3)||(switcher>4))) x[count][count2] = 0;
                     count2 ++;
                  }
                  count ++;
             }
             return x;
      }//end Results

  }//end Examinar

