Advertisement
Hydreigon_Lord

Shiny Pokémon Finder

Mar 21st, 2020
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.95 KB | None | 0 0
  1. //Shiny Pokémon
  2. //Program by Hydreigon_Lord
  3.  
  4. #include <iostream>
  5. #include <cmath>
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     srand(time(0));
  11.     unsigned short trainerID = rand();
  12.     cout << "Trainer ID = " << trainerID << endl;
  13.     unsigned short secretID = rand();
  14.     cout << "Secret ID = " << secretID << endl;
  15.     int numAttempts = 0;
  16.     unsigned int personalityValue = 0;
  17.     while (true)
  18.     {
  19.         numAttempts++;
  20.         personalityValue = (rand() << 16) + rand();
  21.         unsigned short highWord = personalityValue >> 16;
  22.         unsigned short lowWord = (personalityValue << 16) >> 16;
  23.         unsigned short diff = (trainerID ^ secretID) ^ (highWord ^ lowWord);
  24.         if (diff < 16)
  25.         {
  26.             cout << "Shiny found!\nDifference = " << diff << endl;
  27.             break;
  28.         }
  29.     }
  30.     cout << "Personality value = " << personalityValue << endl;
  31.     cout << "Attempts = " << numAttempts << endl;
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement