Advertisement
Kalashnikov

Untitled

Jul 13th, 2011
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.53 KB | None | 0 0
  1. // TODO: loading tierlists from extenel list
  2. // or download and parse PO's raw.zip
  3.  
  4. //  =====================================================================
  5. //   PokeDraft Pack Generator 0.1b
  6. //   by kobo1d
  7. //   07/12/2011
  8. //   Compiler: Microsoft Visual C++ 2008
  9. //   Main.cpp
  10. //  =====================================================================
  11. #include <iostream>
  12. #include <fstream>
  13. #include <iomanip>
  14. #include <time.h>
  15. #include "Pokemon.h"
  16.  
  17. using namespace std;
  18.  
  19.     int lowPokes = 4;
  20.     int midPokes = 3;
  21.     int highPokes = 3;
  22.     int MIN_HIGH = 1;
  23.     int MAX_HIGH = 39;
  24.     int MIN_MID = 40;
  25.     int MAX_MID = 63;
  26.     int MIN_LOW = 64;
  27.     int MAX_LOW = 118;
  28.     int packSize = lowPokes + midPokes + highPokes;
  29.     int tier = 1;
  30.     ofstream myfile;
  31.  
  32.     const int totalTiers = 5;
  33.     char tierNames[totalTiers][10] = { "Uber", "OU", "UU", "RU", "LC"};
  34.     int tierConfig[totalTiers][6] = {
  35.         //MIN_HIGH, MAX_HIGH, MIN_MID, MAX_MID, MIN_LOW, MAX_LOW
  36.         {1,         26,       27,      46,      47,      114}// Tier 0 - Uber
  37.         {1,         39,       40,      63,      64,      118}// Tier 1   ...
  38.         {1,         35,       36,      70,      71,      135}
  39.         {1,         34,       35,      80,      31,      141}
  40.         {1,         25,       26,      36,      37,       69}
  41.     };
  42.     // to add a tier increment totalTiers (and array dimension in Pokemon.h), add it's name to tierNames, its config to tierConfig and thelist of pokemon to pokemonNames from Pokemon.h
  43.  
  44. class Pack {
  45. public:
  46. void Create(int mode, int customConfig[]) {
  47.     int pick;
  48.     int poke;
  49.     int* config;
  50.  
  51.     if (mode)
  52.         config = customConfig;
  53.     else
  54.         config = tierConfig[tier];
  55.  
  56.     for (pick = 0; pick < highPokes || pick < packSize; pick++){   
  57.         poke = rand() % (config[1]-config[0]) + config[0];
  58.         cout << pokemonNames[tier][poke] << endl;
  59.         myfile << pick << pokemonNames[tier][poke] << "\n";
  60.     }
  61.     for (pick = (0+highPokes); pick < (midPokes+highPokes)|| pick < packSize; pick++){ 
  62.         poke = rand() % (config[3]-config[2]) + config[2];
  63.         cout << pokemonNames[tier][poke] << endl;
  64.         myfile << pick << pokemonNames[tier][poke] << "\n";
  65.     }
  66.     for (pick = (0+highPokes+midPokes); pick < packSize; pick++){  
  67.         poke = rand()% (config[5]-config[4]) + config[4];
  68.         cout << pokemonNames[tier][poke] << endl;
  69.         myfile << pick << pokemonNames[tier][poke] << "\n";
  70.     }
  71.     cout << endl;
  72. }
  73. };
  74.  
  75.  
  76. int main(void) {
  77.     int mode = 0;
  78.     int keepGoing = 1;
  79.     int qtyPlayers = 0;
  80.     int qtyPacks = 0;
  81.     int starCount = 0;
  82.     srand ( time(NULL) );
  83.     cout << "kobo1d's PokeDraft Pack Generator" << endl;
  84.     cout << "Current build uses Smogon's June 2011 Usage Stats" << endl << endl;
  85. do {
  86.     myfile.open ("PackOutput.txt");
  87.     myfile << "Pack Generator Output" << "\n";
  88.  
  89.     cout << "Simple or Advanced? " << endl;
  90.     cout << "0 - Simple" << endl;
  91.     cout << "1 - Advanced (custom pick borders)" << endl;
  92.     cin >> mode;
  93.     if (mode != 1 or mode !=0) {
  94.         cout<<"Invalid input";
  95.         continue;
  96.     }
  97.  
  98.     int customConfig[6] = {1, 2, 3, 4, 5, 6};
  99.  
  100.     if (mode) {
  101.         cout << "Number of Pokemon per pack in upper range? " << endl;
  102.         cin >> highPokes;
  103.         cout << "Number of Pokemon per pack in mid range? " << endl;
  104.         cin >> midPokes;
  105.         cout << "Number of Pokemon per pack in lower range? " << endl;
  106.         cin >> lowPokes;
  107.         packSize = highPokes + midPokes + lowPokes;
  108.        
  109.         if (highPokes) {
  110.             cout << "MINIMUM usage ranking for upper range? " << endl;
  111.             cin >> customConfig[0];
  112.             cout << "MAXIMUM usage ranking for upper range? " << endl;
  113.             cin >> customConfig[1];
  114.         }
  115.  
  116.         if(midPokes) {
  117.             cout << "MINIMUM usage ranking for mid range? " << endl;
  118.             cin >> customConfig[2];
  119.             cout << "MAXIMUM usage ranking for mid range? " << endl;
  120.             cin >> customConfig[3];
  121.         }
  122.         if (lowPokes) {
  123.             cout << "MINIMUM usage ranking for lower range? " << endl;
  124.             cin >> customConfig[4];
  125.             cout << "MAXIMUM usage ranking for lower range? " << endl;
  126.             cin >> customConfig[5];
  127.         }
  128.     }
  129.  
  130.     cout << "How many packs would you like to create? ";
  131.     cin >> qtyPacks;
  132.     cout << "Which tier? " << endl;
  133.     for(int i = 0; i<totalTiers; i++) {
  134.         cout << i << " - " << tierNames[i] << endl;
  135.     }
  136.     cin >> tier;
  137.    
  138.     for (starCount = 0; starCount < qtyPacks; starCount++) {
  139.         Pack newPack;
  140.         cout << endl << "PACK " << starCount+1 << endl << endl;
  141.             myfile << "\nPACK " << starCount+1 << "\n";
  142.             newPack.Create(mode, customConfig);
  143.     }
  144.  
  145.     myfile << "\n";
  146.     myfile.close();
  147.  
  148.     cout << "Press 1 to restart program, 0 to exit: ";
  149.     cin >> keepGoing;
  150. } while (keepGoing == 1);
  151.  
  152.     cout << "Most recent set of packs has been saved as PackOutput.txt, Goodbye!" << endl;
  153.     return 0;
  154. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement