Advertisement
Bond697

RS Inheritance

Aug 4th, 2012
487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.02 KB | None | 0 0
  1. #define PARENTS 2
  2. #define IV_INHERIT 3
  3. #define IV_TOTAL 6
  4.  
  5.  
  6. u8 iv_array[IV_TOTAL];
  7. u8 parent_inherit[IV_INHERIT];
  8.  
  9.  
  10.  
  11. inheritance(iv_array, parent_inherit);
  12.  
  13.  
  14. void inheritance(u8* inheritance_array, u8* p_array)
  15. {
  16.     int inheritedIV;
  17.  
  18.     int i;
  19.     for(i = 0, i < IV_TOTAL; ++i)
  20.     {
  21.         inheritance_array[i] = i;
  22.     }
  23.  
  24.  
  25.     for(i = 0; i < IV_INHERIT; ++i)
  26.     {
  27.         inheritedIV = rand() % (IV_TOTAL - i);
  28.  
  29.         doInheritanceCheck(inheritance_array, inheritedIV);
  30.     }
  31.  
  32.  
  33.     for(i = 0; i < IV_INHERIT; ++i)
  34.     {
  35.         p_array[i] = (rand() & 1);
  36.     }
  37.    
  38. }
  39.  
  40.  
  41.  
  42.  
  43. void doInheritanceCheck(u8* original_inheritance_array, int inheritance)
  44. {
  45.     original_inheritance_array[inheritance] = 0xFF;
  46.  
  47.     u8 copy_inheritance_array[IV_TOTAL];
  48.  
  49.     for(i = 0; i < IV_TOTAL; ++i)
  50.     {
  51.  
  52.         copy_inheritance_array[i] = original_inheritance_array[i];
  53.  
  54.     }
  55.  
  56.  
  57.     int j = 0;
  58.  
  59.     for(i = 0; i < IV_TOTAL; ++i)
  60.     {
  61.         if(copy_inheritance_array[i] != 0xFF)
  62.         {
  63.             original_inheritance_array[j] = copy_inheritance_array[i];
  64.             j++;
  65.         }
  66.     }
  67.  
  68. }
  69.  
  70.  
  71. setIVsToEgg();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement