void main()
{
    while(1)
      {
        while(!start_button())
          {
            off(1);
            off(3);
            printf("5=%d, 6=%d     \n", normalizeright(analog(5)), normalizeleft(analog(6)));
            
        }
        
        
        while(normalizeleft(analog(6)) > 50 || normalizeright(analog(6)) > 50)
          {
            //                 printf("5=%d, 6=%d     \n", (analog(5)), (analog(6)));
            
            motor(1, 60);
            motor(3, 60);
        }   
        while (!stop_button())
          {
            //                 printf("5=%d, 6=%d     \n", (analog(5)), (analog(6)));
            
            
            while((normalizeleft(analog(6)) < 50) && !stop_button()) 
              {
                //                     printf("5=%d, 6=%d     \n", (analog(5)), (analog(6)));
                
                motor(3, 100);
                motor(1, -80);
            }
            while((normalizeright(analog(5)) < 50) && !stop_button())
              {
                //    printf("5=%d, 6=%d     \n", (analog(5)), (analog(6)));
                
                motor(1, 100);
                motor(3, -80);
            }
            motor(1, 100);       
            motor(3, 100);
        }
        
    }
}

int normalizeleft(int light)
{
    int MAX_LIGHT = 8;
    int MIN_LIGHT = 74;
    
    int output = 100 - ((light - MAX_LIGHT) * 100) / (MIN_LIGHT - MAX_LIGHT);
    
    if (output < 0) output = 0;
    if (output > 100) output = 100;
    return output;
}


int normalizeright(int light)
{
    int MAX_LIGHT = 8;
    int MIN_LIGHT = 165;
    
    int output = 100 - ((light - MAX_LIGHT) * 100) / (MIN_LIGHT - MAX_LIGHT);
    
    if (output < 0) output = 0;
    if (output > 100) output = 100;
    return output;
}