home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C ++ / Applications / Lotto / lotto_calc_class.cpp next >
Encoding:
C/C++ Source or Header  |  1997-03-17  |  48.6 KB  |  1,911 lines  |  [TEXT/CWIE]

  1.  
  2.  
  3. #include <stdlib.h>
  4. #include <stdio.h>
  5. #include <time.h>
  6. #include <ctype.h>
  7.  
  8. #include "lotto_calc_class.h"
  9.  
  10.  
  11. void lotto_calc::get_hot_pairs( void )
  12. {
  13.     num_of_pairs = 0;
  14.     
  15.     for( int index1 = 1; index1 < 51; index1++ )
  16.     {
  17.         TEST_1 = index1;
  18.         for( int index2 = (index1 + 1); index2 < 52; index2++ )
  19.         {
  20.              TEST_2 = index2;
  21.              for( int index3 = 0; index3 < number_of_records; index3++ )
  22.              {
  23.                  for( int index4 = 0; index4 < 6; index4++ )
  24.                  {
  25.                      if( record[index3]->set[index4] == TEST_1 )
  26.                      {
  27.                          for( int index5 = 0; index5 < 6; index5++ )
  28.                          {
  29.                              if( record[index3]->set[index5] == TEST_2 )
  30.                              {
  31.                                  if( TEST_1 != TEST_2 )
  32.                                  {
  33.                                      thePair[num_of_pairs] = new a_pair;
  34.                                      thePair[num_of_pairs]->PAIR_1 = 0;
  35.                                      thePair[num_of_pairs]->PAIR_2 = 0;
  36.                                      thePair[num_of_pairs]->pair_count = 0;
  37.                                      if( (lotto_calc::record_pair( TEST_1, TEST_2, num_of_pairs )) == true )
  38.                                      {
  39.                                          num_of_pairs++;
  40.                                      } else {
  41.                                          delete( thePair[num_of_pairs] );
  42.                                          }
  43.                                  }
  44.                              }
  45.                          }
  46.                      }
  47.                  }
  48.              }
  49.         }
  50.     }
  51.     // insert 
  52.     lotto_calc::bubble_sort_pairs();
  53.     lotto_calc::get_ten_best_pairs();
  54.     return;
  55. }
  56.     
  57.     
  58. bool lotto_calc::record_pair( int one, int two, int count )
  59. {    
  60.     for( int index1 = 0; index1 < num_of_pairs; index1++ )
  61.     {
  62.         if( (index1 != count) && (index1 <= count) )
  63.         {
  64.             if( thePair[index1]->PAIR_1 == one )
  65.             {
  66.                 if( thePair[index1]->PAIR_2 == two )
  67.                 {
  68.                     thePair[index1]->pair_count += 1;  // keeps track of how many of the same pairs
  69.                     return false;
  70.                 }
  71.             }
  72.         
  73.             if( thePair[index1]->PAIR_1 == two )
  74.             {
  75.                 if( thePair[index1]->PAIR_2 == one )
  76.                 {
  77.                     thePair[index1]->pair_count += 1;
  78.                     return false;
  79.                 }
  80.             }
  81.         }
  82.     }
  83.     thePair[num_of_pairs]->PAIR_1 = one;
  84.     thePair[num_of_pairs]->PAIR_2 = two;
  85.     thePair[num_of_pairs]->pair_count += 1;
  86.     thePair[num_of_pairs]->used = false;
  87.     return true;
  88. }
  89.              
  90. void lotto_calc::bubble_sort_pairs( void )
  91. {
  92.     // puts structs in order of lowest count to highest
  93.     // num_of_pairs will be the highest pair_count
  94.     int size = 0;
  95.     a_pair *hold = NULL;
  96.     
  97.     size = num_of_pairs;
  98.     
  99.         // swap the entire structs
  100.         for( int pass = 1; pass <= (size - 1); pass++ )
  101.         {
  102.             for( int pass2 = 0; pass2 <= (size - 2); pass2++ )
  103.             {
  104.                 if( thePair[pass2]->pair_count > thePair[pass2 + 1]->pair_count )
  105.                 {
  106.                     hold = thePair[pass2];
  107.                     thePair[pass2] = thePair[pass2 + 1];
  108.                     thePair[pass2 + 1] = hold;
  109.                 }
  110.             }
  111.         }
  112.     return;
  113. }
  114.  
  115. void lotto_calc::bubble_sort_sets( int count )
  116. {
  117.     int hold1 = 0;
  118.     int hold2 = 0;
  119.     int size = 6;
  120.     
  121.     for( int index = 0; index <= count; index++ )
  122.     {
  123.         for( int pass = 1; pass <= (size - 1); pass++ )
  124.         {
  125.             for( int pass2 = 0; pass2 <= (size - 2); pass2++ )
  126.             {
  127.                 if( array10[index]->set[pass2] > array10[index]->set[pass2 + 1] )
  128.                 {
  129.                     // swap the numbers and the protection for hot pairs
  130.                     hold1 = array10[index]->set[pass2];
  131.                     hold2 = array10[index]->protect[pass2];
  132.                     array10[index]->set[pass2] = array10[index]->set[pass2 + 1];
  133.                     array10[index]->protect[pass2] = array10[index]->protect[pass2 + 1];
  134.                     array10[index]->set[pass2 + 1] = hold1;
  135.                     array10[index]->protect[pass2 + 1] = hold2;
  136.                 }
  137.             }
  138.         }
  139.     }
  140.     return;
  141. }
  142.  
  143. bool lotto_calc::verify_sets( int arrayNum )
  144. {
  145.     for( int index = 0; index < arrayNum; index++ )
  146.     {
  147.         for( int index2 = 0; index2 < 6; index2++ )
  148.         {
  149.             for( int index3 = 0; index3 < 6; index3++ )
  150.             {
  151.                 if( index2 != index3 )
  152.                 {
  153.                     if( array10[index]->set[index2] == array10[index]->set[index3] )
  154.                     {
  155.                         if( array10[index]->protect[index2] == 0 )
  156.                         {
  157.                             array10[index]->set[index2] = (1 + rand() % 51);
  158.                         } else if( array10[index]->protect[index3] == 0 )
  159.                                  {
  160.                                      array10[index]->set[index3] = (1 + rand() % 51);
  161.                                  } else {
  162.                                      array10[index]->set[index2] = (1 + rand() % 51);
  163.                                      }
  164.                         return false;
  165.                     }
  166.                 }
  167.             }
  168.         }
  169.     }
  170.     return true;
  171. }
  172.     
  173. void lotto_calc::get_ten_best_pairs( void )
  174. {
  175.     int pair_num = 0;
  176.     int limit = 0;
  177.     
  178.     
  179.     // get the pairs that "sunk" to the bottom
  180.     // choose from the twenty best pairs 
  181.     // from bubble_sort_pairs()
  182.     // i.e. num_of_pairs is the greatest number of pairs
  183.     
  184.     
  185.     for( int index = 0; index < 10; index++ )
  186.     {
  187.         limit++;
  188.         
  189.         if( limit > 2500 )
  190.         {
  191.             return;
  192.         }
  193.         do {
  194.                 pair_num = (1 + rand() % (num_of_pairs - 1));
  195.             } while( (pair_num < (num_of_pairs - 26)) || (pair_num > (num_of_pairs - 1)) ); 
  196.         
  197.         if( thePair[pair_num]->used != true )
  198.         {
  199.             ten_hot_pairs[index][0] = thePair[pair_num]->PAIR_1;
  200.             ten_hot_pairs[index][1] = thePair[pair_num]->PAIR_2;
  201.             ten_hot_pairs[index][2] = 0;
  202.             thePair[pair_num]->used = true; // make sure we don't pick it again
  203.         } else {
  204.             index--;
  205.             }
  206.     }
  207.     return;
  208. }
  209.  
  210. void lotto_calc::delete_pair_structs( void )
  211. {
  212.     for( int index = 0; index <= (num_of_pairs - 1); index++ )
  213.     {
  214.         if( thePair[index] )
  215.         {
  216.             delete( thePair[index] );
  217.         }
  218.     }
  219.     num_of_pairs = 0;
  220.     return;
  221. }    
  222.  
  223. bool lotto_calc::get_zero_dists( void )
  224. {
  225.     // get the zero distribution numbers from the last 
  226.     // 10 draws
  227.     int zero_count = 0;
  228.     for( int pass = 0; pass < 52; pass++ )
  229.     {
  230.         zeros[pass] = 1; // meaning zeros are "true"
  231.     }
  232.     
  233.     if( number_of_records < 10 )
  234.     {
  235.         return false;
  236.     }
  237.     
  238.     for( int index = 0; index < 10; index++ )
  239.     {
  240.         for( int index2 = 0; index2 < 6; index2++ )
  241.         {
  242.             for( int index3 = 1; index3 < 52; index3++ )
  243.             {
  244.                 if( index3 == record[index]->set[index2] )
  245.                 {
  246.                     zeros[index3] = 0; // 0 indicates non-zero ( we have a match )
  247.                 }
  248.             }
  249.         }
  250.     }
  251.     
  252.     return true;
  253. }     
  254.  
  255. int lotto_calc::pick_zero_dist( void )
  256. {
  257.     int the_pick = 0;
  258.     
  259.     do {
  260.         the_pick = (1 + rand() % 51);
  261.     } while( zeros[the_pick] == 0 );
  262.     return( the_pick );
  263. }
  264.  
  265. bool lotto_calc::check_if_good_num( int the_guess, int count )
  266. {
  267.     // checks against the first eight sets
  268.     // ... the only sets that can have all different numbers
  269.     // can only have eight with no repeats
  270.     // returns false if it matches ... unless the match is protected (i.e. a hot pair)
  271.     if( count > 8 )
  272.     {
  273.         count = 8;
  274.     }
  275.     for( int index = 0; index < (count - 1); index++ ) 
  276.     {
  277.         for( int index2 = 0; index2 < 6; index2++ )
  278.         {
  279.             if( (array10[index]->set[index2] == the_guess) && (array10[index]->protect == 0) )
  280.             {
  281.                 return false; 
  282.             } 
  283.         }
  284.     }
  285.     return true;
  286. }
  287.  
  288. bool lotto_calc::check_if_good_set( int arrayNum, int setNum )
  289. {
  290.     // checks the set against itself
  291.     for( int index = 0; index < 6; index++ )
  292.     {
  293.         if( index != setNum )
  294.         {
  295.             if( array10[arrayNum]->set[setNum] == array10[arrayNum]->set[index] )
  296.             {
  297.                 return false; // means we have a match
  298.             }
  299.         }
  300.     }
  301.     return true; // means no match i.e. a good number
  302. }
  303.                     
  304.                 
  305.         
  306.  
  307. bool lotto_calc::make_numbers( int user_request )
  308. {
  309.     time_t *cur_time = NULL;
  310.     srand( time(cur_time) );
  311.     
  312.     last_hot_pair = NULL;
  313.     
  314.     int set_count = 0;
  315.     bool tester = NULL;
  316.     int loop_counter = 0;
  317.     int a_guess = 0;
  318.     int been_here_done_that = 0;
  319.     int limit = 0;
  320.     int counter = 0;
  321.     bool badone = false;
  322.     
  323.     bool user_wants = false;
  324.     
  325.     if( user_request > 0 )
  326.     {
  327.         user_wants = true;
  328.     }
  329.     
  330.     if( lotto_calc::read_file() == false )
  331.     {
  332.         return false;
  333.     }
  334.     
  335.     
  336.     if( (lotto_calc::get_zero_dists()) == false )
  337.     {
  338.         return false;
  339.     }
  340.     
  341.     lotto_calc::get_hot_pairs();
  342.     
  343.         // init the array
  344.         if( user_wants == false )
  345.         {
  346.             for( int index = 0; index < MAX_GEN; index++ )
  347.             {
  348.                 array10[index] = new calc_array;
  349.                 lotto_calc::clear_array10( index );
  350.             }
  351.         }
  352.         
  353.         if( user_wants == true )
  354.         {
  355.             for( int index2 = 0; index2 < user_wants; user_wants++ )
  356.             {
  357.                 array10[index2] = new calc_array;
  358.                 lotto_calc::clear_array10( index2 );
  359.             }
  360.         }
  361.         
  362.     
  363.     do {
  364.     
  365.         begin: // yeah, ok, its a goto, so sue me!!
  366.         
  367.             if( set_count == 0 )
  368.             {
  369.                 for( int doit = 0; doit < 10; doit++ )
  370.                 {
  371.                     ten_hot_pairs[doit][2] = 0;
  372.                 }
  373.                 for( int index = 0; index < num_of_pairs; index++ )
  374.                 {
  375.                     thePair[index]->used = false;
  376.                 }
  377.             }
  378.                 
  379.             lotto_calc::clear_array10( set_count );
  380.     
  381.         if( (lotto_calc::get_a_hot_pair( set_count )) == false )
  382.         {
  383.             array10[set_count]->set[0] = (1 + rand() % 51);
  384.             array10[set_count]->set[1] = (1 + rand() % 51);
  385.         }
  386.         
  387.         loop_counter = 0;
  388.         
  389.         do {
  390.             array10[set_count]->set[2] = pick_zero_dist();
  391.             
  392.             if( set_count < 8 )
  393.             {
  394.                 tester = lotto_calc::check_if_good_num( array10[set_count]->set[2], set_count );
  395.             } else {
  396.                 tester = true;
  397.                 }
  398.             loop_counter++;
  399.         } while( (tester == false) && (loop_counter <= 1000) );
  400.         
  401.         if(tester == true )
  402.         {
  403.             array10[set_count]->protect[2] = 1;
  404.         }
  405.         if( tester == false )
  406.         {
  407.             array10[set_count]->set[2] = (1 + rand() % 51);
  408.             array10[set_count]->protect[2] = 0;
  409.         }
  410.         
  411.         for( int loop = 0; loop < 3; loop++ )
  412.         {
  413.             a_guess = NULL;
  414.             
  415.             switch( (a_guess = (1 + rand() % 5)) )
  416.             {
  417.                 case 1:
  418.                 {
  419.                     while( (lotto_calc::is_odd( (array10[set_count]->set[loop + 3] 
  420.                                 = (1 + rand() % 51))) ) == false ){;}
  421.                     break;
  422.                 }
  423.                 case 2:
  424.                 {
  425.                     while( (lotto_calc::is_white( (array10[set_count]->set[loop + 3] 
  426.                                 = (1 + rand() % 51))) ) == false ){;}
  427.                     break;
  428.                 }
  429.                 case 3:
  430.                 {
  431.                     if( (lotto_calc::is_blue( (array10[set_count]->set[loop + 3] 
  432.                                 = (1 + rand() % 51))) ) == false ){;}
  433.                     break;
  434.                 }
  435.                 case 4:
  436.                 {
  437.                     while( (lotto_calc::is_red( (array10[set_count]->set[loop + 3] 
  438.                               = (1 + rand() % 51))) ) == false ){;}     
  439.                     break;
  440.                 }
  441.                 case 5:
  442.                 {
  443.                     while( (lotto_calc::is_even( (array10[set_count]->set[loop + 3]
  444.                                 = (1 + rand() % 51))) ) == false ){;}
  445.                     break;
  446.                 }
  447.             }
  448.         }
  449.         
  450.             for( int index = 0; index < set_count; index++ )
  451.             {
  452.                 for( int index2 = 0; index2 < 6; index2++ )
  453.                 {
  454.                     if( lotto_calc::check_if_good_num( (array10[index]->set[index2]), set_count ) == false )
  455.                     {
  456.                         if( array10[index]->protect[index2] == 0 )
  457.                         {
  458.                             array10[index]->set[index2] = (1 + rand() % 51);
  459.                             index--;
  460.                         }
  461.                     }
  462.                 }
  463.             } 
  464.             
  465.             if( set_count < 8 )
  466.             {
  467.                 limit = 5000;
  468.             } else { 
  469.                 limit = 250;
  470.                 }
  471.             
  472.             while( (lotto_calc::check_if_valid_sets( set_count ) == false) && (counter <= limit) )
  473.             {
  474.                 counter++;
  475.             }
  476.             counter = 0;
  477.             
  478.             while( lotto_calc::verify_sets( set_count ) == false ){;}
  479.             
  480.             for( int index = 0; index < 6; index++ )
  481.             {
  482.                 if( (lotto_calc::check_if_good_set( set_count, index )) == false )
  483.                 {
  484.                     lotto_calc::reset_last_hot_pair( set_count );
  485.                     goto begin;
  486.                 }
  487.             }
  488.             
  489.             badone = false;
  490.             if( set_count == 7 && been_here_done_that < 250 )
  491.             {
  492.                 been_here_done_that++;
  493.                 
  494.                 // check set 0 against itself
  495.                 if( array10[0]->set[0] == 0 ){badone = true;}
  496.                 if( array10[0]->set[0] == array10[0]->set[1] ){badone = true;}
  497.                 if( array10[0]->set[0] == array10[0]->set[2] ){badone = true;}
  498.                 if( array10[0]->set[0] == array10[0]->set[3] ){badone = true;}
  499.                 if( array10[0]->set[0] == array10[0]->set[4] ){badone = true;}
  500.                 if( array10[0]->set[0] == array10[0]->set[5] ){badone = true;}
  501.                 
  502.                 // check set 1 against itself
  503.                 if( array10[1]->set[0] == 0 ){badone = true;}
  504.                 if( array10[1]->set[0] == array10[1]->set[1] ){badone = true;}
  505.                 if( array10[1]->set[0] == array10[1]->set[2] ){badone = true;}
  506.                 if( array10[1]->set[0] == array10[1]->set[3] ){badone = true;}
  507.                 if( array10[1]->set[0] == array10[1]->set[4] ){badone = true;}
  508.                 if( array10[1]->set[0] == array10[1]->set[5] ){badone = true;}
  509.                 
  510.                 // check set 2 against itself
  511.                 if( array10[2]->set[0] == 0 ){badone = true;}
  512.                 if( array10[2]->set[0] == array10[2]->set[1] ){badone = true;}
  513.                 if( array10[2]->set[0] == array10[2]->set[2] ){badone = true;}
  514.                 if( array10[2]->set[0] == array10[2]->set[3] ){badone = true;}
  515.                 if( array10[2]->set[0] == array10[2]->set[4] ){badone = true;}
  516.                 if( array10[2]->set[0] == array10[2]->set[5] ){badone = true;}
  517.                 
  518.                 // check set 3 against itself
  519.                 if( array10[3]->set[0] == 0 ){badone = true;}
  520.                 if( array10[3]->set[0] == array10[3]->set[1] ){badone = true;}
  521.                 if( array10[3]->set[0] == array10[3]->set[2] ){badone = true;}
  522.                 if( array10[3]->set[0] == array10[3]->set[3] ){badone = true;}
  523.                 if( array10[3]->set[0] == array10[3]->set[4] ){badone = true;}
  524.                 if( array10[3]->set[0] == array10[3]->set[5] ){badone = true;}
  525.                 
  526.                 // check set 4 against itself
  527.                 if( array10[4]->set[0] == 0 ){badone = true;}
  528.                 if( array10[4]->set[0] == array10[4]->set[1] ){badone = true;}
  529.                 if( array10[4]->set[0] == array10[4]->set[2] ){badone = true;}
  530.                 if( array10[4]->set[0] == array10[4]->set[3] ){badone = true;}
  531.                 if( array10[4]->set[0] == array10[4]->set[4] ){badone = true;}
  532.                 if( array10[4]->set[0] == array10[4]->set[5] ){badone = true;}
  533.                 
  534.                 // check set 5 against itself
  535.                 if( array10[5]->set[0] == 0 ){badone = true;}
  536.                 if( array10[5]->set[0] == array10[5]->set[1] ){badone = true;}
  537.                 if( array10[5]->set[0] == array10[5]->set[2] ){badone = true;}
  538.                 if( array10[5]->set[0] == array10[5]->set[3] ){badone = true;}
  539.                 if( array10[5]->set[0] == array10[5]->set[4] ){badone = true;}
  540.                 if( array10[5]->set[0] == array10[5]->set[5] ){badone = true;}
  541.                 
  542.                 // check set 6 against itself
  543.                 if( array10[6]->set[0] == 0 ){badone = true;}
  544.                 if( array10[6]->set[0] == array10[6]->set[1] ){badone = true;}
  545.                 if( array10[6]->set[0] == array10[6]->set[2] ){badone = true;}
  546.                 if( array10[6]->set[0] == array10[6]->set[3] ){badone = true;}
  547.                 if( array10[6]->set[0] == array10[6]->set[4] ){badone = true;}
  548.                 if( array10[6]->set[0] == array10[6]->set[5] ){badone = true;}
  549.                 
  550.                 // check set 7 against itself
  551.                 if( array10[7]->set[0] == 0 ){badone = true;}
  552.                 if( array10[7]->set[0] == array10[7]->set[1] ){badone = true;}
  553.                 if( array10[7]->set[0] == array10[7]->set[2] ){badone = true;}
  554.                 if( array10[7]->set[0] == array10[7]->set[3] ){badone = true;}
  555.                 if( array10[7]->set[0] == array10[7]->set[4] ){badone = true;}
  556.                 if( array10[7]->set[0] == array10[7]->set[5] ){badone = true;}
  557.                 
  558.                 // check set 0 against set 1
  559.                 for(int apass1 = 0; apass1 < 6; apass1++ )
  560.                 {
  561.                     if( array10[0]->set[0] == array10[1]->set[apass1] ){badone = true;}
  562.                     if( array10[0]->set[1] == array10[1]->set[apass1] ){badone = true;}
  563.                     if( array10[0]->set[2] == array10[1]->set[apass1] ){badone = true;}
  564.                     if( array10[0]->set[3] == array10[1]->set[apass1] ){badone = true;}
  565.                     if( array10[0]->set[4] == array10[1]->set[apass1] ){badone = true;}
  566.                     if( array10[0]->set[5] == array10[1]->set[apass1] ){badone = true;}
  567.                 }
  568.                 
  569.                 // check set 0 against set 2
  570.                 for(int apass2 = 0; apass2 < 6; apass2++ )
  571.                 {
  572.                     if( array10[0]->set[0] == array10[2]->set[apass2] ){badone = true;}
  573.                     if( array10[0]->set[1] == array10[2]->set[apass2] ){badone = true;}
  574.                     if( array10[0]->set[2] == array10[2]->set[apass2] ){badone = true;}
  575.                     if( array10[0]->set[3] == array10[2]->set[apass2] ){badone = true;}
  576.                     if( array10[0]->set[4] == array10[2]->set[apass2] ){badone = true;}
  577.                     if( array10[0]->set[5] == array10[2]->set[apass2] ){badone = true;}
  578.                 }
  579.                 
  580.                 // check set 0 against set 3
  581.                 for(int apass3 = 0; apass3 < 6; apass3++ )
  582.                 {
  583.                     if( array10[0]->set[0] == array10[3]->set[apass3] ){badone = true;}
  584.                     if( array10[0]->set[1] == array10[3]->set[apass3] ){badone = true;}
  585.                     if( array10[0]->set[2] == array10[3]->set[apass3] ){badone = true;}
  586.                     if( array10[0]->set[3] == array10[3]->set[apass3] ){badone = true;}
  587.                     if( array10[0]->set[4] == array10[3]->set[apass3] ){badone = true;}
  588.                     if( array10[0]->set[5] == array10[3]->set[apass3] ){badone = true;}
  589.                 }
  590.                 
  591.                 // check set 0 against set 4
  592.                 for(int apass4 = 0; apass4 < 6; apass4++ )
  593.                 {
  594.                     if( array10[0]->set[0] == array10[4]->set[apass4] ){badone = true;}
  595.                     if( array10[0]->set[1] == array10[4]->set[apass4] ){badone = true;}
  596.                     if( array10[0]->set[2] == array10[4]->set[apass4] ){badone = true;}
  597.                     if( array10[0]->set[3] == array10[4]->set[apass4] ){badone = true;}
  598.                     if( array10[0]->set[4] == array10[4]->set[apass4] ){badone = true;}
  599.                     if( array10[0]->set[5] == array10[4]->set[apass4] ){badone = true;}
  600.                 }
  601.                 
  602.                 // check set 0 against set 5
  603.                 for(int apass5 = 0; apass5 < 6; apass5++ )
  604.                 {
  605.                     if( array10[0]->set[0] == array10[5]->set[apass5] ){badone = true;}
  606.                     if( array10[0]->set[1] == array10[5]->set[apass5] ){badone = true;}
  607.                     if( array10[0]->set[2] == array10[5]->set[apass5] ){badone = true;}
  608.                     if( array10[0]->set[3] == array10[5]->set[apass5] ){badone = true;}
  609.                     if( array10[0]->set[4] == array10[5]->set[apass5] ){badone = true;}
  610.                     if( array10[0]->set[5] == array10[5]->set[apass5] ){badone = true;}
  611.                 }
  612.                 
  613.                 // check set 0 against set 6
  614.                 for(int apass6 = 0; apass6 < 6; apass6++ )
  615.                 {
  616.                     if( array10[0]->set[0] == array10[6]->set[apass6] ){badone = true;}
  617.                     if( array10[0]->set[1] == array10[6]->set[apass6] ){badone = true;}
  618.                     if( array10[0]->set[2] == array10[6]->set[apass6] ){badone = true;}
  619.                     if( array10[0]->set[3] == array10[6]->set[apass6] ){badone = true;}
  620.                     if( array10[0]->set[4] == array10[6]->set[apass6] ){badone = true;}
  621.                     if( array10[0]->set[5] == array10[6]->set[apass6] ){badone = true;}
  622.                 }
  623.                 
  624.                 // check set 0 against set 7
  625.                 for(int apass7 = 0; apass7 < 6; apass7++ )
  626.                 {
  627.                     if( array10[0]->set[0] == array10[1]->set[apass7] ){badone = true;}
  628.                     if( array10[0]->set[1] == array10[1]->set[apass7] ){badone = true;}
  629.                     if( array10[0]->set[2] == array10[1]->set[apass7] ){badone = true;}
  630.                     if( array10[0]->set[3] == array10[1]->set[apass7] ){badone = true;}
  631.                     if( array10[0]->set[4] == array10[1]->set[apass7] ){badone = true;}
  632.                     if( array10[0]->set[5] == array10[1]->set[apass7] ){badone = true;}
  633.                 }
  634.                 
  635.                 // check set 1 against set 2
  636.                 for(int bpass2 = 0; bpass2 < 6; bpass2++ )
  637.                 {
  638.                     if( array10[1]->set[0] == array10[2]->set[bpass2] ){badone = true;}
  639.                     if( array10[1]->set[1] == array10[2]->set[bpass2] ){badone = true;}
  640.                     if( array10[1]->set[2] == array10[2]->set[bpass2] ){badone = true;}
  641.                     if( array10[1]->set[3] == array10[2]->set[bpass2] ){badone = true;}
  642.                     if( array10[1]->set[4] == array10[2]->set[bpass2] ){badone = true;}
  643.                     if( array10[1]->set[5] == array10[2]->set[bpass2] ){badone = true;}
  644.                 }
  645.                 
  646.                 // check set 1 against set 3
  647.                 for(int bpass3 = 0; bpass3 < 6; bpass3++ )
  648.                 {
  649.                     if( array10[1]->set[0] == array10[3]->set[bpass3] ){badone = true;}
  650.                     if( array10[1]->set[1] == array10[3]->set[bpass3] ){badone = true;}
  651.                     if( array10[1]->set[2] == array10[3]->set[bpass3] ){badone = true;}
  652.                     if( array10[1]->set[3] == array10[3]->set[bpass3] ){badone = true;}
  653.                     if( array10[1]->set[4] == array10[3]->set[bpass3] ){badone = true;}
  654.                     if( array10[1]->set[5] == array10[3]->set[bpass3] ){badone = true;}
  655.                 }
  656.                 
  657.                 // check set 1 against set 4
  658.                 for(int bpass4 = 0; bpass4 < 6; bpass4++ )
  659.                 {
  660.                     if( array10[1]->set[0] == array10[4]->set[bpass4] ){badone = true;}
  661.                     if( array10[1]->set[1] == array10[4]->set[bpass4] ){badone = true;}
  662.                     if( array10[1]->set[2] == array10[4]->set[bpass4] ){badone = true;}
  663.                     if( array10[1]->set[3] == array10[4]->set[bpass4] ){badone = true;}
  664.                     if( array10[1]->set[4] == array10[4]->set[bpass4] ){badone = true;}
  665.                     if( array10[1]->set[5] == array10[4]->set[bpass4] ){badone = true;}
  666.                 }
  667.                 
  668.                 // check set 1 against set 5
  669.                 for(int bpass5 = 0; bpass5 < 6; bpass5++ )
  670.                 {
  671.                     if( array10[1]->set[0] == array10[5]->set[bpass5] ){badone = true;}
  672.                     if( array10[1]->set[1] == array10[5]->set[bpass5] ){badone = true;}
  673.                     if( array10[1]->set[2] == array10[5]->set[bpass5] ){badone = true;}
  674.                     if( array10[1]->set[3] == array10[5]->set[bpass5] ){badone = true;}
  675.                     if( array10[1]->set[4] == array10[5]->set[bpass5] ){badone = true;}
  676.                     if( array10[1]->set[5] == array10[5]->set[bpass5] ){badone = true;}
  677.                 }
  678.                 
  679.                 // check set 1 against set 6
  680.                 for(int bpass6 = 0; bpass6 < 6; bpass6++ )
  681.                 {
  682.                     if( array10[1]->set[0] == array10[6]->set[bpass6] ){badone = true;}
  683.                     if( array10[1]->set[1] == array10[6]->set[bpass6] ){badone = true;}
  684.                     if( array10[1]->set[2] == array10[6]->set[bpass6] ){badone = true;}
  685.                     if( array10[1]->set[3] == array10[6]->set[bpass6] ){badone = true;}
  686.                     if( array10[1]->set[4] == array10[6]->set[bpass6] ){badone = true;}
  687.                     if( array10[1]->set[5] == array10[6]->set[bpass6] ){badone = true;}
  688.                 }
  689.                 
  690.                 // check set 1 against set 7
  691.                 for(int bpass7 = 0; bpass7 < 6; bpass7++ )
  692.                 {
  693.                     if( array10[1]->set[0] == array10[7]->set[bpass7] ){badone = true;}
  694.                     if( array10[1]->set[1] == array10[7]->set[bpass7] ){badone = true;}
  695.                     if( array10[1]->set[2] == array10[7]->set[bpass7] ){badone = true;}
  696.                     if( array10[1]->set[3] == array10[7]->set[bpass7] ){badone = true;}
  697.                     if( array10[1]->set[4] == array10[7]->set[bpass7] ){badone = true;}
  698.                     if( array10[1]->set[5] == array10[7]->set[bpass7] ){badone = true;}
  699.                 }
  700.                 
  701.                 // check set 2 against set 3
  702.                 for(int cpass3 = 0; cpass3 < 6; cpass3++ )
  703.                 {
  704.                     if( array10[2]->set[0] == array10[3]->set[cpass3] ){badone = true;}
  705.                     if( array10[2]->set[1] == array10[3]->set[cpass3] ){badone = true;}
  706.                     if( array10[2]->set[2] == array10[3]->set[cpass3] ){badone = true;}
  707.                     if( array10[2]->set[3] == array10[3]->set[cpass3] ){badone = true;}
  708.                     if( array10[2]->set[4] == array10[3]->set[cpass3] ){badone = true;}
  709.                     if( array10[2]->set[5] == array10[3]->set[cpass3] ){badone = true;}
  710.                 }
  711.                 
  712.                 // check set 2 against set 4
  713.                 for(int cpass4 = 0; cpass4 < 6; cpass4++ )
  714.                 {
  715.                     if( array10[2]->set[0] == array10[4]->set[cpass4] ){badone = true;}
  716.                     if( array10[2]->set[1] == array10[4]->set[cpass4] ){badone = true;}
  717.                     if( array10[2]->set[2] == array10[4]->set[cpass4] ){badone = true;}
  718.                     if( array10[2]->set[3] == array10[4]->set[cpass4] ){badone = true;}
  719.                     if( array10[2]->set[4] == array10[4]->set[cpass4] ){badone = true;}
  720.                     if( array10[2]->set[5] == array10[4]->set[cpass4] ){badone = true;}
  721.                 }
  722.                 
  723.                 // check set 2 against set 5
  724.                 for(int cpass5 = 0; cpass5 < 6; cpass5++ )
  725.                 {
  726.                     if( array10[2]->set[0] == array10[5]->set[cpass5] ){badone = true;}
  727.                     if( array10[2]->set[1] == array10[5]->set[cpass5] ){badone = true;}
  728.                     if( array10[2]->set[2] == array10[5]->set[cpass5] ){badone = true;}
  729.                     if( array10[2]->set[3] == array10[5]->set[cpass5] ){badone = true;}
  730.                     if( array10[2]->set[4] == array10[5]->set[cpass5] ){badone = true;}
  731.                     if( array10[2]->set[5] == array10[5]->set[cpass5] ){badone = true;}
  732.                 }
  733.                 
  734.                 // check set 2 against set 6
  735.                 for(int cpass6 = 0; cpass6 < 6; cpass6++ )
  736.                 {
  737.                     if( array10[2]->set[0] == array10[6]->set[cpass6] ){badone = true;}
  738.                     if( array10[2]->set[1] == array10[6]->set[cpass6] ){badone = true;}
  739.                     if( array10[2]->set[2] == array10[6]->set[cpass6] ){badone = true;}
  740.                     if( array10[2]->set[3] == array10[6]->set[cpass6] ){badone = true;}
  741.                     if( array10[2]->set[4] == array10[6]->set[cpass6] ){badone = true;}
  742.                     if( array10[2]->set[5] == array10[6]->set[cpass6] ){badone = true;}
  743.                 }
  744.                 
  745.                 // check set 2 against set 7
  746.                 for(int cpass7 = 0; cpass7 < 6; cpass7++ )
  747.                 {
  748.                     if( array10[2]->set[0] == array10[7]->set[cpass7] ){badone = true;}
  749.                     if( array10[2]->set[1] == array10[7]->set[cpass7] ){badone = true;}
  750.                     if( array10[2]->set[2] == array10[7]->set[cpass7] ){badone = true;}
  751.                     if( array10[2]->set[3] == array10[7]->set[cpass7] ){badone = true;}
  752.                     if( array10[2]->set[4] == array10[7]->set[cpass7] ){badone = true;}
  753.                     if( array10[2]->set[5] == array10[7]->set[cpass7] ){badone = true;}
  754.                 }
  755.                 
  756.                 // check set 3 against set 4
  757.                 for(int dpass4 = 0; dpass4 < 6; dpass4++ )
  758.                 {
  759.                     if( array10[3]->set[0] == array10[4]->set[dpass4] ){badone = true;}
  760.                     if( array10[3]->set[1] == array10[4]->set[dpass4] ){badone = true;}
  761.                     if( array10[3]->set[2] == array10[4]->set[dpass4] ){badone = true;}
  762.                     if( array10[3]->set[3] == array10[4]->set[dpass4] ){badone = true;}
  763.                     if( array10[3]->set[4] == array10[4]->set[dpass4] ){badone = true;}
  764.                     if( array10[3]->set[5] == array10[4]->set[dpass4] ){badone = true;}
  765.                 }
  766.                 
  767.                 // check set 3 against set 5
  768.                 for(int dpass5 = 0; dpass5 < 6; dpass5++ )
  769.                 {
  770.                     if( array10[3]->set[0] == array10[5]->set[dpass5] ){badone = true;}
  771.                     if( array10[3]->set[1] == array10[5]->set[dpass5] ){badone = true;}
  772.                     if( array10[3]->set[2] == array10[5]->set[dpass5] ){badone = true;}
  773.                     if( array10[3]->set[3] == array10[5]->set[dpass5] ){badone = true;}
  774.                     if( array10[3]->set[4] == array10[5]->set[dpass5] ){badone = true;}
  775.                     if( array10[3]->set[5] == array10[5]->set[dpass5] ){badone = true;}
  776.                 }
  777.                 
  778.                 // check set 3 against set 6
  779.                 for(int dpass6 = 0; dpass6 < 6; dpass6++ )
  780.                 {
  781.                     if( array10[3]->set[0] == array10[6]->set[dpass6] ){badone = true;}
  782.                     if( array10[3]->set[1] == array10[6]->set[dpass6] ){badone = true;}
  783.                     if( array10[3]->set[2] == array10[6]->set[dpass6] ){badone = true;}
  784.                     if( array10[3]->set[3] == array10[6]->set[dpass6] ){badone = true;}
  785.                     if( array10[3]->set[4] == array10[6]->set[dpass6] ){badone = true;}
  786.                     if( array10[3]->set[5] == array10[6]->set[dpass6] ){badone = true;}
  787.                 }
  788.                 
  789.                 // check set 3 against set 7
  790.                 for(int dpass7 = 0; dpass7 < 6; dpass7++ )
  791.                 {
  792.                     if( array10[3]->set[0] == array10[7]->set[dpass7] ){badone = true;}
  793.                     if( array10[3]->set[1] == array10[7]->set[dpass7] ){badone = true;}
  794.                     if( array10[3]->set[2] == array10[7]->set[dpass7] ){badone = true;}
  795.                     if( array10[3]->set[3] == array10[7]->set[dpass7] ){badone = true;}
  796.                     if( array10[3]->set[4] == array10[7]->set[dpass7] ){badone = true;}
  797.                     if( array10[3]->set[5] == array10[7]->set[dpass7] ){badone = true;}
  798.                 }
  799.                 
  800.                 // check set 4 against set 5
  801.                 for(int epass5 = 0; epass5 < 6; epass5++ )
  802.                 {
  803.                     if( array10[4]->set[0] == array10[5]->set[epass5] ){badone = true;}
  804.                     if( array10[4]->set[1] == array10[5]->set[epass5] ){badone = true;}
  805.                     if( array10[4]->set[2] == array10[5]->set[epass5] ){badone = true;}
  806.                     if( array10[4]->set[3] == array10[5]->set[epass5] ){badone = true;}
  807.                     if( array10[4]->set[4] == array10[5]->set[epass5] ){badone = true;}
  808.                     if( array10[4]->set[5] == array10[5]->set[epass5] ){badone = true;}
  809.                 }
  810.                 
  811.                 // check set 4 against set 6
  812.                 for(int epass6 = 0; epass6 < 6; epass6++ )
  813.                 {
  814.                     if( array10[4]->set[0] == array10[6]->set[epass6] ){badone = true;}
  815.                     if( array10[4]->set[1] == array10[6]->set[epass6] ){badone = true;}
  816.                     if( array10[4]->set[2] == array10[6]->set[epass6] ){badone = true;}
  817.                     if( array10[4]->set[3] == array10[6]->set[epass6] ){badone = true;}
  818.                     if( array10[4]->set[4] == array10[6]->set[epass6] ){badone = true;}
  819.                     if( array10[4]->set[5] == array10[6]->set[epass6] ){badone = true;}
  820.                 }
  821.                 
  822.                 // check set 4 against set 7
  823.                 for(int epass7 = 0; epass7 < 6; epass7++ )
  824.                 {
  825.                     if( array10[4]->set[0] == array10[7]->set[epass7] ){badone = true;}
  826.                     if( array10[4]->set[1] == array10[7]->set[epass7] ){badone = true;}
  827.                     if( array10[4]->set[2] == array10[7]->set[epass7] ){badone = true;}
  828.                     if( array10[4]->set[3] == array10[7]->set[epass7] ){badone = true;}
  829.                     if( array10[4]->set[4] == array10[7]->set[epass7] ){badone = true;}
  830.                     if( array10[4]->set[5] == array10[7]->set[epass7] ){badone = true;}
  831.                 }
  832.                 
  833.                 // check set 5 against set 6
  834.                 for(int fpass6 = 0; fpass6 < 6; fpass6++ )
  835.                 {
  836.                     if( array10[5]->set[0] == array10[6]->set[fpass6] ){badone = true;}
  837.                     if( array10[5]->set[1] == array10[6]->set[fpass6] ){badone = true;}
  838.                     if( array10[5]->set[2] == array10[6]->set[fpass6] ){badone = true;}
  839.                     if( array10[5]->set[3] == array10[6]->set[fpass6] ){badone = true;}
  840.                     if( array10[5]->set[4] == array10[6]->set[fpass6] ){badone = true;}
  841.                     if( array10[5]->set[5] == array10[6]->set[fpass6] ){badone = true;}
  842.                 }
  843.                 
  844.                 // check set 5 against set 7
  845.                 for(int fpass7 = 0; fpass7 < 6; fpass7++ )
  846.                 {
  847.                     if( array10[5]->set[0] == array10[7]->set[fpass7] ){badone = true;}
  848.                     if( array10[5]->set[1] == array10[7]->set[fpass7] ){badone = true;}
  849.                     if( array10[5]->set[2] == array10[7]->set[fpass7] ){badone = true;}
  850.                     if( array10[5]->set[3] == array10[7]->set[fpass7] ){badone = true;}
  851.                     if( array10[5]->set[4] == array10[7]->set[fpass7] ){badone = true;}
  852.                     if( array10[5]->set[5] == array10[7]->set[fpass7] ){badone = true;}
  853.                 }
  854.                 
  855.                 // check set 6 against set 7
  856.                 for(int gpass7 = 0; gpass7 < 6; gpass7++ )
  857.                 {
  858.                     if( array10[6]->set[0] == array10[7]->set[gpass7] ){badone = true;}
  859.                     if( array10[6]->set[1] == array10[7]->set[gpass7] ){badone = true;}
  860.                     if( array10[6]->set[2] == array10[7]->set[gpass7] ){badone = true;}
  861.                     if( array10[6]->set[3] == array10[7]->set[gpass7] ){badone = true;}
  862.                     if( array10[6]->set[4] == array10[7]->set[gpass7] ){badone = true;}
  863.                     if( array10[6]->set[5] == array10[7]->set[gpass7] ){badone = true;}
  864.                 }
  865.             }
  866.             
  867.             if( badone == true )
  868.             {
  869.                 set_count = 0;
  870.                 for( int doit = 0; doit < 10; doit++ )
  871.                 {
  872.                     ten_hot_pairs[doit][2] = 0;
  873.                                     }
  874.                 for( int index = 0; index < num_of_pairs; index++ )
  875.                 {
  876.                     thePair[index]->used = false;
  877.                 }
  878.                 goto begin;
  879.             }
  880.             
  881.             
  882.             for( int index = 0; index < set_count; index++ )
  883.             {
  884.                 for( int index2 = 0; index2 < 6; index2++ )
  885.                 {
  886.                     if( lotto_calc::check_if_good_num( (array10[index]->set[index2]), set_count ) == false )
  887.                     {
  888.                         if( array10[index]->protect[index2] == 0 )
  889.                         {
  890.                             array10[index]->set[index2] = (1 + rand() % 51);
  891.                             index--;
  892.                         }
  893.                     }
  894.                 }
  895.             } 
  896.             
  897.             
  898.             
  899.             for( int index = 0; index < 6; index++ )
  900.             {
  901.                 if( (lotto_calc::check_if_good_set( set_count, index )) == false )
  902.                 {
  903.                     lotto_calc::reset_last_hot_pair( set_count );
  904.                     goto begin;
  905.                 }
  906.             }
  907.             
  908.             if( set_count < 8 )
  909.             {
  910.                 limit = 2500;
  911.             } else { 
  912.                 limit = 250;
  913.                 }
  914.             
  915.             while( (lotto_calc::check_if_valid_sets( set_count ) == false) && (counter <= limit) )
  916.             {
  917.                 counter++;
  918.             }
  919.             counter = 0;
  920.             
  921.             while( lotto_calc::verify_sets( set_count ) == false ){;}
  922.             
  923.             for( int index = 0; index < set_count; index++ )
  924.             {
  925.                 for( int index2 = 0; index2 < 6; index2++ )
  926.                 {
  927.                     if( lotto_calc::check_if_good_num( (array10[index]->set[index2]), set_count ) == false )
  928.                     {
  929.                         if( array10[index]->protect[index2] == 0 )
  930.                         {
  931.                             array10[index]->set[index2] = (1 + rand() % 51);
  932.                             index--;
  933.                         }
  934.                     }
  935.                 }
  936.             } 
  937.             
  938.             
  939.             
  940.             
  941.             
  942.             for( int index = 0; index < 6; index++ )
  943.             {
  944.                 if( (lotto_calc::check_if_good_set( set_count, index )) == false )
  945.                 {
  946.                     lotto_calc::reset_last_hot_pair( set_count );
  947.                     goto begin;
  948.                 }
  949.             }
  950.             
  951.             
  952.             
  953.             if( set_count < 8 )
  954.             {
  955.                 limit = 2500;
  956.             } else { 
  957.                 limit = 250;
  958.                 }
  959.             
  960.             while( (lotto_calc::check_if_valid_sets( set_count ) == false) && (counter <= limit) )
  961.             {
  962.                 counter++;
  963.             }
  964.             counter = 0;
  965.             
  966.             while( lotto_calc::verify_sets( set_count ) == false ){;}
  967.             
  968.             lotto_calc::check_missing_numbers( set_count );
  969.             
  970.             while( lotto_calc::check_matrix( set_count ) == false ){;}
  971.             
  972.             if(lotto_calc::check_for_too_many( set_count ) == false )
  973.             {
  974.                 lotto_calc::reset_last_hot_pair( set_count );
  975.                 while( lotto_calc::check_matrix( set_count ) == false ){;}
  976.             }
  977.             
  978.             for( int ant = 0; ant < (set_count - 1); ant++ )
  979.             {
  980.                 for( int ant2 = (ant + 1); ant2 < set_count; ant2++ )
  981.                 {
  982.                     if( ant != ant2 )
  983.                     {
  984.                         if( array10[ant]->set[0] == array10[ant2]->set[0] )
  985.                         {
  986.                             lotto_calc::lotto_calc::reset_last_hot_pair( set_count );
  987.                             set_count--;
  988.                             goto begin;
  989.                         }
  990.                     }
  991.                 }
  992.             }
  993.             
  994.             if( lotto_calc::recheck_sets( set_count ) == false )
  995.             {
  996.                 set_count = 0;
  997.                 been_here_done_that = 0;
  998.                 for( int doit = 0; doit < 10; doit++ )
  999.                 {
  1000.                     ten_hot_pairs[doit][2] = 0;
  1001.                 }
  1002.                 for( int index = 0; index < num_of_pairs; index++ )
  1003.                 {
  1004.                     thePair[index]->used = false;
  1005.                 }
  1006.                 goto begin;
  1007.             }
  1008.             
  1009.             if( (lotto_calc::check_against_database( set_count )) == false )
  1010.             {
  1011.                 lotto_calc::reset_last_hot_pair( set_count );
  1012.                 goto begin;
  1013.             }
  1014.             
  1015.             for( int index = 0; index < 6; index++ )
  1016.             {
  1017.                 if( (lotto_calc::check_if_good_set( set_count, index )) == false )
  1018.                 {
  1019.                     lotto_calc::reset_last_hot_pair( set_count );
  1020.                     goto begin;
  1021.                 }
  1022.             }
  1023.             
  1024.             if( set_count == (MAX_GEN - 1)  )
  1025.             {    
  1026.                 if( (lotto_calc::is_funky( set_count )) == true )
  1027.                 {
  1028.                     set_count = 0;
  1029.                     for( int doit = 0; doit < 10; doit++ )
  1030.                     {
  1031.                         ten_hot_pairs[doit][2] = 0;
  1032.                     }
  1033.                     for( int index = 0; index < num_of_pairs; index++ )
  1034.                     {
  1035.                         thePair[index]->used = false;
  1036.                     }
  1037.                     goto begin;
  1038.                 }
  1039.             }
  1040.             
  1041.             for( int ant = 0; ant < (set_count - 1); ant++ )
  1042.             {
  1043.                 for( int ant2 = (ant + 1); ant2 < set_count; ant2++ )
  1044.                 {
  1045.                     if( ant != ant2 )
  1046.                     {
  1047.                         if( array10[ant]->set[0] == array10[ant2]->set[0] )
  1048.                         {
  1049.                             lotto_calc::lotto_calc::reset_last_hot_pair( set_count );
  1050.                             set_count--;
  1051.                             goto begin;
  1052.                         }
  1053.                     }
  1054.                 }
  1055.             }
  1056.             
  1057.             
  1058.             if( set_count <= 8 )
  1059.             {
  1060.                 for( int test = 0; test < (set_count - 1); test++ )
  1061.                 {
  1062.                     for( int test2 = (test + 1); test < set_count; test++ )
  1063.                     {
  1064.                         for( int test3 = 0; test3 < 5; test3++ )
  1065.                         {
  1066.                             for( int test4 = ( test3 + 1 ); test4 < 6; test4++ )
  1067.                             {
  1068.                                 if( array10[test]->set[test3] == array10[test2]->set[test4] )
  1069.                                 {
  1070.                                     set_count = 0;
  1071.                                     for( int doit = 0; doit < 10; doit++ )
  1072.                                     {
  1073.                                         ten_hot_pairs[doit][2] = 0;
  1074.                                     }
  1075.                                     for( int index = 0; index < num_of_pairs; index++ )
  1076.                                     {
  1077.                                         thePair[index]->used = false;
  1078.                                     }
  1079.                                     goto begin;
  1080.                                 }
  1081.                             }
  1082.                         }
  1083.                     }
  1084.                 }
  1085.             }
  1086.             
  1087.             for( int pas = 0; pas < set_count; pas++ )
  1088.             {
  1089.                 for( int pas2 = 0; pas2 < 6; pas2++ )
  1090.                 {
  1091.                     if( array10[pas]->set[pas2] == 0 )
  1092.                     {
  1093.                         set_count = 0;
  1094.                         for( int doit = 0; doit < 10; doit++ )
  1095.                         {
  1096.                             ten_hot_pairs[doit][2] = 0;
  1097.                         }
  1098.                         for( int index = 0; index < num_of_pairs; index++ )
  1099.                         {
  1100.                             thePair[index]->used = false;
  1101.                         }
  1102.                         goto begin;
  1103.                     }
  1104.                 }
  1105.             }
  1106.             
  1107.             if( set_count == 9 )
  1108.             {
  1109.                 while( (lotto_calc::check_last_two_lows()) == false ){;}
  1110.             }
  1111.             
  1112.             // *WHEW* we made it this far ... must be a good one!
  1113.             
  1114.             lotto_calc::bubble_sort_sets( set_count );
  1115.             lotto_calc::get_calc_stats( set_count );
  1116.             set_count++;
  1117.             
  1118.             for( int pass = 0; pass < set_count; pass++ )
  1119.             {
  1120.                 lotto_calc::bubble_sort_sets( pass );
  1121.                 lotto_calc::get_calc_stats( pass );
  1122.             }
  1123.                 
  1124.             
  1125.     } while( (set_count < MAX_GEN) );
  1126.     
  1127.     // getting ready to exit
  1128.     // make sure we have all the stats and clean up and get out
  1129.     for( int pass = 0; pass < set_count; pass++ )
  1130.     {
  1131.         lotto_calc::bubble_sort_sets( pass );
  1132.         lotto_calc::get_calc_stats( pass );
  1133.     }
  1134.     lotto_calc::delete_pair_structs();
  1135.     lotto_calc::clear_records();
  1136.     return true;
  1137. }
  1138.  
  1139. void lotto_calc::clear_stats( int theArray )
  1140. {
  1141.     array10[theArray]->reds = 0;
  1142.     array10[theArray]->whites = 0;
  1143.     array10[theArray]->blues = 0;
  1144.     array10[theArray]->evens = 0;
  1145.     array10[theArray]->odds = 0;
  1146. }
  1147.  
  1148. bool lotto_calc::get_a_hot_pair( int count )
  1149. {
  1150.     int guess = 0;
  1151.     int bail_out = 0;
  1152.     bool is_good = false;
  1153.     
  1154.     
  1155.     // try to get one of the best pairs
  1156.     do {
  1157.           guess = (1 + rand() % 10);
  1158.           bail_out++;
  1159.          
  1160.           if( ten_hot_pairs[(guess - 1)][2] == 1 )
  1161.           {
  1162.                   is_good = false;
  1163.           }
  1164.           if( ten_hot_pairs[(guess - 1)][2] == 0 )
  1165.           {
  1166.                   is_good = true;
  1167.                   array10[count]->set[0] = ten_hot_pairs[(guess - 1)][0];
  1168.                   array10[count]->set[1] = ten_hot_pairs[(guess - 1)][1];
  1169.                   array10[count]->protect[0] = 1;
  1170.                   array10[count]->protect[1] = 1;
  1171.                   ten_hot_pairs[(guess - 1)][2] = 1; // "used"
  1172.                   last_hot_pair = (guess - 1);
  1173.                   return true;
  1174.           }
  1175.          } while( (is_good == false) && (bail_out <= 2500) );
  1176.          
  1177.          
  1178.          // if not ... then reset bail_out and just get a pair
  1179.          bail_out = 0;
  1180.     
  1181.     do {
  1182.         guess = (1 + rand() % (num_of_pairs - 1));
  1183.         bail_out++;
  1184.         if( bail_out > 5000 )
  1185.         {
  1186.             return false;
  1187.         }
  1188.     } while( thePair[guess]->used == true );
  1189.     
  1190.     thePair[guess]->used = true;
  1191.     array10[count]->set[0] = thePair[guess]->PAIR_1;
  1192.     array10[count]->protect[0] = 1;
  1193.     array10[count]->set[1] = thePair[guess]->PAIR_2;
  1194.     array10[count]->protect[1] = 1;
  1195.     return true;
  1196. }
  1197.  
  1198. void lotto_calc::reset_last_hot_pair( int count )
  1199. {
  1200.     array10[count]->set[0] = 0;
  1201.     array10[count]->set[1] = 0;
  1202.     array10[count]->protect[0] = 0;
  1203.     array10[count]->protect[1] = 0;
  1204.     ten_hot_pairs[last_hot_pair][2] = 0; // "not used"
  1205.     last_hot_pair = NULL;
  1206.     return;
  1207. }
  1208.     
  1209. void lotto_calc::clear_array10( int arrayNum )
  1210. {
  1211.     // fill everything with nulls to help avoid garbage input
  1212.         for( int index2 = 0; index2 < 6; index2++ )
  1213.         {
  1214.             array10[arrayNum]->set[index2] = NULL;
  1215.             array10[arrayNum]->protect[index2] = NULL;
  1216.             array10[arrayNum]->distrib[index2] = NULL;
  1217.         }
  1218.         array10[arrayNum]->reds = NULL;
  1219.         array10[arrayNum]->whites = NULL;
  1220.         array10[arrayNum]->blues = NULL;
  1221.         array10[arrayNum]->evens = NULL;
  1222.         array10[arrayNum]->odds = NULL;
  1223.     return;
  1224. }
  1225.  
  1226. void lotto_calc::get_calc_stats( int count )
  1227. {
  1228.     lotto_calc::clear_stats( count );
  1229.         for( int index2 = 0; index2 < 6; index2++ )
  1230.         {
  1231.             if( array10[count]->set[index2] == 0 )
  1232.             {
  1233.                 break;
  1234.             }
  1235.             if( (lotto_calc::is_red( array10[count]->set[index2] )) == true )
  1236.             {
  1237.                 array10[count]->reds += 1;
  1238.             }
  1239.             if( (lotto_calc::is_white( array10[count]->set[index2] )) == true )
  1240.             {
  1241.                 array10[count]->whites += 1;
  1242.             }
  1243.             if( (lotto_calc::is_blue( array10[count]->set[index2] )) == true )
  1244.             {
  1245.                 array10[count]->blues += 1;
  1246.             }
  1247.             if( (lotto_calc::is_odd( array10[count]->set[index2] )) == true )
  1248.             {
  1249.                 array10[count]->odds += 1;
  1250.             }
  1251.             if( (lotto_calc::is_even( array10[count]->set[index2] )) == true )
  1252.             {
  1253.                 array10[count]->evens += 1;
  1254.             }
  1255.         }
  1256.         for( int index3 = 0; index3 < 51; index3++ )
  1257.         {
  1258.             for( int index4 = 0; index4 < 6; index4++ )
  1259.             {
  1260.                 array10[count]->distrib[index4] = zeros[(array10[count]->set[index4])];
  1261.             }
  1262.         }
  1263.     return;
  1264. }
  1265.                 
  1266.             
  1267.             
  1268. bool lotto_calc::is_red( int check )
  1269. {
  1270.     if( (check > 0) && (check < 18) )
  1271.     {
  1272.         return true;
  1273.     } else {
  1274.         return false;
  1275.         }
  1276. }
  1277.  
  1278. bool lotto_calc::is_white( int check )
  1279. {
  1280.     if( (check > 17) && (check < 35) )
  1281.     {
  1282.         return true;
  1283.     } else {
  1284.         return false;
  1285.         }
  1286. }
  1287.  
  1288. bool lotto_calc::is_blue( int check )
  1289. {
  1290.     if( (check > 34) && (check < 52) )
  1291.     {
  1292.         return true;
  1293.     } else {
  1294.         return false;
  1295.         }
  1296. }
  1297.  
  1298. bool lotto_calc::is_odd( int check )
  1299. {
  1300.     if( (check % 2) != 0 )
  1301.     {
  1302.         return true;
  1303.     } else {
  1304.         return false;
  1305.         }
  1306. }
  1307.  
  1308. bool lotto_calc::is_even( int check )
  1309. {
  1310.     if( (check % 2) == 0 )
  1311.     {
  1312.         return true;
  1313.     } else {
  1314.         return false;
  1315.         }
  1316. }
  1317.  
  1318. bool lotto_calc::check_against_database( int arrayNum )
  1319. {
  1320.     int match_count = 0;
  1321.     
  1322.     for( int index = 0; index < (number_of_records - 1); index++ )
  1323.     {
  1324.         for( int index2 = 0; index2 < 6; index2++ )
  1325.         {
  1326.             if( array10[arrayNum]->set[index2] == record[index]->set[index2] )
  1327.             {
  1328.                 match_count++;
  1329.             }    
  1330.         }
  1331.     }
  1332.     
  1333.     if( match_count == 6 )
  1334.     {
  1335.         return false;
  1336.     } else {
  1337.         return true;
  1338.         }
  1339. }
  1340.  
  1341. bool lotto_calc::is_funky( int count )
  1342. {
  1343.     int limit = 0;
  1344.     limit = (MAX_GEN / 3);
  1345.     
  1346.     int red = 0;
  1347.     int white = 0;
  1348.     int blue = 0;
  1349.     int even = 0;
  1350.     int odd = 0;
  1351.     
  1352.     lotto_calc::get_calc_stats( count );
  1353.     
  1354.     for( int index = 0; index < count; index++ )
  1355.     {
  1356.         if( array10[index]->reds > 3 )
  1357.         {
  1358.             red++;
  1359.         }
  1360.         if( array10[index]->whites > 3 )
  1361.         {
  1362.             white++;
  1363.         }
  1364.         if( array10[index]->blues > 3 )
  1365.         {
  1366.             blue ++;
  1367.         }
  1368.         if( array10[index]->evens > 3 )
  1369.         {
  1370.             even++;
  1371.         }
  1372.         if( array10[index]->odds > 3 )
  1373.         {
  1374.             odd++;
  1375.         }
  1376.     }
  1377.     
  1378.     if( red > limit ) return true;
  1379.     if( white > limit ) return true;
  1380.     if( blue > limit ) return true;
  1381.     if( odd > limit ) return true;
  1382.     if( even > limit ) return true;
  1383.     
  1384.     return false;
  1385. }
  1386.         
  1387. bool lotto_calc::check_if_valid_sets( int arrayNum )
  1388. {    
  1389.     if( arrayNum == 0 )
  1390.     {
  1391.         return true;
  1392.     }
  1393.     
  1394.     for( int index = 0; index < arrayNum; index++ )
  1395.     {
  1396.         for( int index2 = 0; index2 < 6; index2++ )
  1397.         {
  1398.             for( int index3 = 0; index3 <= arrayNum; index3++ )
  1399.             {
  1400.                 for( int index4 = 0; index4 < 6; index4++ )
  1401.                 {
  1402.                     if( index == index3 )
  1403.                     {
  1404.                         if( (index != index3) && (index2 != index4) )
  1405.                         {
  1406.                             if( array10[index]->set[index2] == array10[index3]->set[index4] )
  1407.                             {
  1408.                                 if( index < 8 )
  1409.                                 {
  1410.                                     if( array10[index]->protect == 0 )
  1411.                                     {
  1412.                                         array10[index]->set[index2] = (1 + rand() % 51);
  1413.                                     } else if( array10[index3]->protect[index4] == 0 )
  1414.                                              {
  1415.                                                   array10[index3]->set[index4] = (1 + rand() % 51);
  1416.                                              } else {
  1417.                                                  array10[index]->set[index2] = (1 + rand() % 51 );
  1418.                                                  array10[index]->protect[index2] = 0;
  1419.                                                  }
  1420.                                     return false;
  1421.                                 }
  1422.                             }
  1423.                         }
  1424.                     }
  1425.                 }
  1426.             }
  1427.         }
  1428.     }
  1429.     return true;
  1430. }
  1431.                                 
  1432. void lotto_calc::check_missing_numbers( int arrayNum )
  1433. {
  1434.     int eight_count = 0;
  1435.     int nine_count = 0;
  1436.     int index3 = 0;
  1437.     int index4 = 0;
  1438.     int num_check[52];
  1439.     int guess = 0;
  1440.     
  1441.     for( int pass = 0; pass < 52; pass++ )
  1442.     {
  1443.         num_check[pass] = 0;
  1444.     }
  1445.     
  1446.     if( arrayNum >= 9 )
  1447.     {
  1448.         for( int index = 0; index < 8; index++ )
  1449.         {
  1450.             for( int index5 = 0; index5 < 6; index5++ )
  1451.             {
  1452.                 num_check[(array10[index]->set[index5])]++;
  1453.             }
  1454.         }
  1455.     
  1456.     do {
  1457.             guess = (1 + rand() % 51);
  1458.             
  1459.             if( num_check[guess] == 0 )
  1460.             {
  1461.                 array10[8]->set[eight_count] = guess;
  1462.                 array10[8]->protect[eight_count] = 0;
  1463.                 num_check[guess] = 1;
  1464.                 eight_count++;
  1465.             }
  1466.             if( num_check[guess] > 0 )
  1467.             {
  1468.                 index3++;
  1469.             }
  1470.         } while( (index3 < 51) && (eight_count < 6) );
  1471.         
  1472.     do {
  1473.             guess = (1 + rand() % 51);
  1474.             
  1475.             if( num_check[guess] == 0 )
  1476.             {
  1477.                 array10[9]->set[eight_count] = guess;
  1478.                 array10[8]->protect[eight_count] = 0;
  1479.                 num_check[guess] = 1;
  1480.                 eight_count++;
  1481.             }
  1482.             if( num_check[guess] > 0 )
  1483.             {
  1484.                 index4++;
  1485.             }
  1486.         } while( (index4 < 51) && (nine_count < 6) );
  1487.     }
  1488.     
  1489. }
  1490.     
  1491. bool lotto_calc::check_matrix( int arrayNum )
  1492. {
  1493.      for( int index = 0; index < arrayNum; index++ )
  1494.      {
  1495.          for( int index2 = 0; index2 < 6; index2++ )
  1496.          {
  1497.              for( int index3 = 0; index3 < arrayNum; index3++ )
  1498.              {
  1499.                  for( int index4 = 0; index4 < 6; index4++ )
  1500.                  {
  1501.                      if( index != index3 )
  1502.                      {
  1503.                          if( array10[index]->set[index2] == array10[index3]->set[index4] )
  1504.                          {
  1505.                              if( array10[index]->protect[index2] == 0 )
  1506.                              {
  1507.                                  if( array10[index]->set[index2] < 25 )
  1508.                                  {
  1509.                                      do {
  1510.                                              array10[index]->set[index2] = ( 1 + rand() % 51 );
  1511.                                          } while( (array10[index]->set[index2] < 25) || 
  1512.                                                      (array10[index]->set[index2] > 51) );
  1513.                                      return false;
  1514.                                  } else {
  1515.                                      do {
  1516.                                              array10[index]->set[index2] = ( 1 + rand() % 51 );
  1517.                                          } while( (array10[index]->set[index2] > 25) ||
  1518.                                                      (array10[index]->set[index2] < 1 ) );
  1519.                                      return false;
  1520.                                      }
  1521.                              }
  1522.                          }
  1523.                      }
  1524.                      if( index == index3 )
  1525.                      {
  1526.                          if( index2 != index4 )
  1527.                          {
  1528.                              if( array10[index]->set[index2] == array10[index3]->set[index4] )
  1529.                              {
  1530.                                  if( array10[index]->protect[index2] == 0 )
  1531.                                  {
  1532.                                      if( array10[index]->set[index2] < 25 )
  1533.                                      {
  1534.                                          do {
  1535.                                                  array10[index]->set[index2] = ( 1 + rand() % 51 );
  1536.                                              } while( (array10[index]->set[index2] < 25) || 
  1537.                                                          (array10[index]->set[index2] > 51) );
  1538.                                          return false;
  1539.                                      } else {
  1540.                                          do {
  1541.                                                  array10[index]->set[index2] = ( 1 + rand() % 51 );
  1542.                                              } while( (array10[index]->set[index2] > 25) ||
  1543.                                                          (array10[index]->set[index2] < 1 ) );
  1544.                                          return false;
  1545.                                      }
  1546.                                  }
  1547.                              }
  1548.                          }
  1549.                      }
  1550.                  }
  1551.              }
  1552.          }
  1553.      }
  1554.  return true;
  1555. }
  1556.  
  1557. bool lotto_calc::recheck_sets( int arrayNum )
  1558. {
  1559.     int checker[51];
  1560.     static int been_here;
  1561.     
  1562.     if( arrayNum < 9 )
  1563.     {
  1564.         been_here = 0;
  1565.     }
  1566.     
  1567.     if( been_here >= 1000 )
  1568.     {
  1569.         return true;
  1570.     }
  1571.     
  1572.     if( arrayNum >= 9 )
  1573.     {
  1574.         been_here++;
  1575.         for( int pass = 0; pass < arrayNum; pass++ )
  1576.         {
  1577.             for( int pass2 = 0; pass2 < 6; pass2++ )
  1578.             {
  1579.                 checker[(array10[pass]->set[pass2])]++;
  1580.             }
  1581.         }
  1582.         for( int pass3 = 0; pass3 < 51; pass3++ )
  1583.         {
  1584.             if( checker[pass3] == 0 )
  1585.             {
  1586.                 return false;
  1587.             }
  1588.         }
  1589.     } 
  1590.     return true;
  1591. }
  1592.     
  1593.      
  1594. bool lotto_calc::check_for_too_many( int arrayNum )
  1595. {
  1596.     int the_check[51] = {NULL};
  1597.     static int done_that;
  1598.     static int array_check[10][6];
  1599.     
  1600.     if( arrayNum < 9 )
  1601.     {
  1602.         done_that = 0;
  1603.         for( int pass = 0; pass < 10; pass++ )
  1604.         {
  1605.             for( int pass2 = 0; pass2 < 6; pass2++ )
  1606.             {
  1607.                 array_check[pass][pass2] = 0;
  1608.             }
  1609.         }
  1610.         return true;
  1611.     }
  1612.     
  1613.     
  1614.     if( done_that >= 4 ) // allow 4 protected numbers to be changed
  1615.     {
  1616.         return true;
  1617.     }
  1618.     
  1619.     for( int index = 0; index < arrayNum; index++ )
  1620.     {
  1621.         for( int index2 = 0; index2 < 6; index2++ )
  1622.         {                            
  1623.              the_check[(array10[index]->set[index2])]++;
  1624.          }
  1625.      }
  1626.      for( int index3 = 0; index3 < 51; index3++ )
  1627.      { 
  1628.          if( the_check[index3] > 2 )
  1629.          {
  1630.              for( int index4 = arrayNum; index4 <= 0; index4-- )
  1631.              {
  1632.                  for( int index5 = 0; index5 < 6; index5++ )
  1633.                  {
  1634.                      if( array_check[index4][index5] != 1 )
  1635.                      {
  1636.                          if( array10[index4]->protect[index5] == 1 )
  1637.                          {
  1638.                              array10[index4]->protect[index5] = 0;
  1639.                              array_check[index4][index5] = 1;
  1640.                              done_that++;
  1641.                              return false;
  1642.                          }
  1643.                      }
  1644.                  }
  1645.              }
  1646.          }
  1647.      }
  1648.      return true;
  1649. }    
  1650.  
  1651. int lotto_calc::get_rollover( void )
  1652. {
  1653.     int total = 0;
  1654.     int average = 0;
  1655.     int hits = 0;
  1656.     
  1657.     lotto_calc::read_file();
  1658.     for( int pass = 1; pass < number_of_records; pass++ )
  1659.     {
  1660.         if( record[0]->set[0] == record[pass]->set[0] )
  1661.         {
  1662.             if( record[0]->set[0] < record[pass - 1]->set[0] )
  1663.             {
  1664.                 total += ( (record[pass - 1]->set[0]) - (record[0]->set[0]) );
  1665.                 hits++;
  1666.             } else {
  1667.                 total += ( (record[0]->set[0]) - (record[pass - 1]->set[0]) );
  1668.                 hits++;
  1669.                 }
  1670.         }
  1671.     }
  1672.     lotto_calc::clear_records();
  1673.     
  1674.     average = ( total / hits );
  1675.     return( average );
  1676. }
  1677.  
  1678. bool lotto_calc::predict_set( void )
  1679. {
  1680.     int hold = 0;
  1681.     int hits_1 = 0;
  1682.     int temp_1 = 0;
  1683.     int hits_2 = 0;
  1684.     int temp_2 = 0;
  1685.     int hits_3 = 0;
  1686.     int temp_3 = 0;
  1687.     int red_avg = 0;
  1688.     int white_avg = 0;
  1689.     int blue_avg = 0;
  1690.     int count = 0;
  1691.     
  1692.     for( int n = 0; n < 6; n++ )
  1693.     {
  1694.         p_set->the_set[n] = 0;
  1695.     }
  1696.     
  1697.     p_set->the_set[0] = lotto_calc::get_rollover();
  1698.     
  1699.     lotto_calc::read_file();
  1700.     
  1701.     // find out how many reds, whites & blues we need
  1702.     for( int pas1 = 1; pas1 < number_of_records; pas1++ )
  1703.     {
  1704.         if( record[0]->reds == record[pas1]->reds )
  1705.         {
  1706.             temp_1 += record[pas1 - 1]->reds;
  1707.             hits_1++;
  1708.         }
  1709.     }
  1710.     red_avg = ( temp_1 / hits_1 );
  1711.     
  1712.     for( int pas3 = 1; pas3 < number_of_records; pas3++ )
  1713.     {
  1714.         if( record[0]->whites == record[pas3]->whites )
  1715.         {
  1716.             temp_2 += record[pas3 - 1]->whites;
  1717.             hits_2++;
  1718.         }
  1719.     }
  1720.     white_avg = ( temp_2 / hits_2 );
  1721.     
  1722.     for( int pas5 = 1; pas5 < number_of_records; pas5++ )
  1723.     {
  1724.         if( record[0]->blues == record[pas5]->blues )
  1725.         {
  1726.             temp_3 += record[pas5 - 1]->blues;
  1727.             hits_3++;
  1728.         }
  1729.     }
  1730.     blue_avg = ( temp_3 / hits_3 );
  1731.     
  1732.     while( (red_avg + white_avg + blue_avg) > 6 )
  1733.     {
  1734.         int choose = 0;
  1735.         choose = (1 + rand() % 3);
  1736.         switch( choose )
  1737.         {
  1738.             case 1:
  1739.             {
  1740.                 red_avg--;
  1741.                 break;
  1742.             }
  1743.             case 2:
  1744.             {
  1745.                 white_avg--;
  1746.                 break;
  1747.             }
  1748.             case 3:
  1749.             {
  1750.                 blue_avg--;
  1751.                 break;
  1752.             }
  1753.             default:
  1754.             {
  1755.                 break;
  1756.             }
  1757.         }
  1758.     }
  1759.     
  1760.     while( (red_avg + white_avg + blue_avg) < 6 )
  1761.     {
  1762.         int choose = 0;
  1763.         choose = (1 + rand() % 3);
  1764.         switch( choose )
  1765.         {
  1766.             case 1:
  1767.             {
  1768.                 red_avg++;
  1769.                 break;
  1770.             }
  1771.             case 2:
  1772.             {
  1773.                 white_avg++;
  1774.                 break;
  1775.             }
  1776.             case 3:
  1777.             {
  1778.                 blue_avg++;
  1779.                 break;
  1780.             }
  1781.             default:
  1782.             {
  1783.                 break;
  1784.             }
  1785.         }
  1786.     }
  1787.     
  1788.     if( (lotto_calc::is_red( p_set->the_set[0] )) == true )
  1789.     {
  1790.         red_avg--;
  1791.     }
  1792.     if( (lotto_calc::is_blue( p_set->the_set[0] )) == true )
  1793.     {
  1794.         blue_avg--;
  1795.     }
  1796.     if( (lotto_calc::is_white( p_set->the_set[0] )) == true )
  1797.     {
  1798.         white_avg--;
  1799.     }
  1800.     
  1801.     count = 1; // we already have p_set->the_set[0]
  1802.     
  1803.     // get random reds, whites & blues to fill needed amounts
  1804.     for( int pas2 = 0; pas2 < red_avg; pas2++ )
  1805.     {
  1806.         if( lotto_calc::is_red( p_set->the_set[0] ) == true )
  1807.         {
  1808.             pas2++;
  1809.         }
  1810.         while( (lotto_calc::is_red( p_set->the_set[count] = (1 + rand() % 51))) != true 
  1811.                     || p_set->the_set[count] < p_set->the_set[0]){;}
  1812.         count++;
  1813.     }
  1814.     for( int pas4 = 0; pas4 < white_avg; pas4++ )
  1815.     {
  1816.         if( lotto_calc::is_white( p_set->the_set[0] ) == true )
  1817.         {
  1818.             pas4++;
  1819.         }
  1820.         while( (lotto_calc::is_white( p_set->the_set[count] = (1 + rand() % 51))) != true 
  1821.                     || p_set->the_set[count] < p_set->the_set[0]){;}
  1822.         count++;
  1823.     }
  1824.     for( int pas6 = 0; pas6 < blue_avg; pas6++ )
  1825.     {
  1826.         if( lotto_calc::is_blue( p_set->the_set[0] ) == true )
  1827.         {
  1828.             pas6++;
  1829.         }
  1830.         while( (lotto_calc::is_blue( p_set->the_set[count] = (1 + rand() % 51))) != true 
  1831.                     || p_set->the_set[count] < p_set->the_set[0]){;}
  1832.         count++;
  1833.     }
  1834.     
  1835.     for( int index = 0; index < 6; index++ )
  1836.     {
  1837.         for( int index2 = (index + 1); index2 < 6; index2++ )
  1838.         {
  1839.             if( p_set->the_set[index] == 0 )
  1840.             {
  1841.                 return( false );
  1842.             }
  1843.             if( p_set->the_set[index] == p_set->the_set[index2] )
  1844.             {
  1845.                 return( false );
  1846.             }
  1847.         }
  1848.     }
  1849.     
  1850.     for( int check = 0; check < 6; check++ )
  1851.     {
  1852.         if( p_set->the_set[0] == 0 )
  1853.         {
  1854.             return false;
  1855.         }
  1856.     }
  1857.     
  1858.     for( int pass = 1; pass <= (6 - 1); pass++ )
  1859.         {
  1860.             for( int pass2 = 0; pass2 <= (6 - 2); pass2++ )
  1861.             {
  1862.                 if( p_set->the_set[pass2] > p_set->the_set[pass2 + 1] )
  1863.                 {
  1864.                     hold = p_set->the_set[pass2];
  1865.                     p_set->the_set[pass2] = p_set->the_set[pass2 + 1];
  1866.                     p_set->the_set[pass2 + 1] = hold;
  1867.                 }
  1868.             }
  1869.         }
  1870.         
  1871.     return ( true );
  1872. }
  1873.  
  1874. bool lotto_calc::check_last_two_lows( void )
  1875. {
  1876.     for( int la = 0; la < 7; la++ )
  1877.     {
  1878.         for( int la2 = 0; la2 < 6; la2++ )
  1879.         {
  1880.             if( array10[9]->set[0] == array10[la]->set[la2] )
  1881.             {
  1882.                 do {
  1883.                          array10[9]->set[0] = (1 + rand() % 25);
  1884.                     } while( array10[9]->set[0] == array10[la]->set[la2] );
  1885.                 return false;
  1886.             }
  1887.                         
  1888.             if( array10[8]->set[0] == array10[la]->set[la2] )
  1889.             {
  1890.                 do {
  1891.                         array10[8]->set[0] = (1 + rand() % 51);
  1892.                     } while( array10[8]->set[0] == array10[la]->set[la2] );
  1893.                 return false;
  1894.             }
  1895.         }
  1896.     }
  1897.     return true;
  1898. }
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.  
  1911.