Advertisement
Guest User

Untitled

a guest
May 1st, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 9.10 KB | None | 0 0
  1. /* This program attempts to calculate the total number of possible gag combinations on toontown. For now, the program assumes no cogs are already lured (This would change if it was possible to use a trap gag). The major complexity of the project revolves around eliminating the duplicate cases of multi hit attacks. Assumption: Using a multi hit gag on 2 or more cogs only counts as one move.
  2.  
  3. @author Steve /u/cardinalfan828
  4.  */
  5.  
  6. #include <iostream>
  7. #include <math.h>
  8.  
  9. using namespace std;
  10.  
  11. class Toontastic
  12. {
  13.     public:
  14.         Toontastic();
  15.         void oneToon();
  16.         void twoToons();
  17.         void threeToons();
  18.         void fourToons();
  19.         int getT();
  20.         void addT(int);
  21.     private:
  22.         int grandTotal;    
  23. };
  24.  
  25. int main()
  26. {
  27.     cout << "This program attempts to output the number of possible gag combinations in toontown." << endl;
  28.     cout << "\nAssumptions:\n\tA toon can not toon themselves up." << endl;
  29.     cout << "\tUsing multiple traps on the same cog counts as a valid combination. \n\t\tLikewise, using lure and drop together is also valid." << endl;
  30.     cout << "\tBasic Formula:" << endl;
  31.     cout << "\t\tToonsinBattleCogsInBattle = (SingleHitGags * cogs) + multiHitGags + \n\t\t(SingleHitToonup * (ToonsInBattle - 1)) + MultiHitToonup " << endl;
  32.     cout << "\tThe first two variables only keep track of single and multi hit gags exculding toon-up." << endl;
  33.     cout << "\tWhen one toon is in battle, the 2 toon-up variables are ignored.\n" << endl;
  34.     Toontastic flippy; 
  35.     flippy.Toontastic::oneToon();
  36.     flippy.Toontastic::twoToons();
  37.     flippy.Toontastic::threeToons();
  38.     flippy.Toontastic::fourToons();
  39.  
  40.     return 0;
  41. }
  42.  
  43. Toontastic::Toontastic()
  44. {
  45.     grandTotal = 0;
  46. }
  47.  
  48. int Toontastic::getT()
  49. {
  50.     return grandTotal;
  51. }
  52.  
  53. void Toontastic::addT(int part)
  54. {
  55.     grandTotal += part;
  56. }
  57.  
  58. void Toontastic::oneToon()
  59. {
  60.    
  61.     /*multi hit gags will only count 1 way not n ways for n cogs in the battle. These are: 4 toon up    gags, 4 lure gags, all (7) sound gags, 1 throw gag, 1 squirt gag, and 1 drop gag.
  62.     4 Toon Up
  63.     4 Lure
  64.     7 Sound
  65.     1 Throw
  66.     1 Squirt
  67.     1 Drop
  68.     18 Total Multi Hit Gags
  69.     31 Total Single Hit Gags  
  70.     14 Total for 1 toon when not counting toon up.
  71.  
  72.     24 Total for 1 toon when not counting toon up.
  73.     42 non toon up gags
  74.     7 toon up gags
  75.     */
  76.     int toons = 1;
  77.     const int tot = 49;
  78.     const int mH = 18;
  79.     const int sH = 24;
  80.     const int tuS = 3;
  81.     const int tuM = 4;
  82.     int cogs = 0;
  83.  
  84.     int t1 = 0;
  85.     int t1c1 = 0;
  86.     int t1c2 = 0;
  87.     int t1c3 = 0;
  88.     int t1c4 = 0;
  89.  
  90.     cogs = 1; //one cog
  91.     t1c1 = (sH * cogs) + mH;
  92.     t1c1 = t1c1 * t1c1;
  93.     cout << "Combos with " << toons << " toon " << "and " << cogs << " cog: " << t1c1 << endl;
  94.  
  95.     cogs = 2; //two cogs
  96.     t1c2 = (sH * cogs) + mH;
  97.     t1c2 = t1c2 * t1c2; // for each one, other can chose all of their choices
  98.     cout << "Combos with " << toons << " toon " << "and " << cogs << " cogs: " << t1c2 << endl;
  99.    
  100.     cogs = 3; //three cogs
  101.     t1c3 = (sH * cogs) + mH;
  102.     t1c3 = t1c3 * t1c3;
  103.     cout << "Combos with " << toons << " toon " << "and " << cogs << " cogs: " << t1c3 << endl;
  104.  
  105.     cogs = 4; //four cogs
  106.     t1c4 = (sH * cogs) + mH;
  107.     t1c4 = t1c4 * t1c4;
  108.     cout << "Combos with " << toons << " toon " << "and " << cogs << " cogs: " << t1c4 << endl;
  109.    
  110.     cout << "\n";
  111.     t1 = t1c1 + t1c2 + t1c3 + t1c4; //adds cog subtotals to subtotal of for 2 toons
  112.     cout << "The total possible combinations of gags with 2 toons: " << t1 << endl;
  113.     addT(t1); //adds partial of all of 2 toons to the grand total
  114.     cout << "The grand total of combinations is: " << Toontastic::getT() << "\n" << endl;
  115. }
  116.  
  117. void Toontastic::twoToons()
  118. {
  119.    
  120.     /*multi hit gags will only count 1 way not n ways for n cogs in the battle. These are: 4 toon up    gags, 4 lure gags, all (7) sound gags, 1 throw gag, 1 squirt gag, and 1 drop gag.
  121.     4 Toon Up
  122.     4 Lure
  123.     7 Sound
  124.     1 Throw
  125.     1 Squirt
  126.     1 Drop
  127.     18 Total Multi Hit Gags, 14 Total for 1 toon when not counting toon up.
  128.     31 Total Single Hit Gags, 24 Total for 1 toon when not counting toon up.
  129.     42 non toon up gags
  130.     7 toon up gags
  131.     */
  132.     int toons = 2;
  133.     const int tot = 49;
  134.     const int mH = 18;
  135.     const int sH = 24;
  136.     const int tuS = 3;
  137.     const int tuM = 4;
  138.     int cogs = 0;
  139.  
  140.     int t2 = 0;
  141.     int t2c1 = 0;
  142.     int t2c2 = 0;
  143.     int t2c3 = 0;
  144.     int t2c4 = 0;
  145.  
  146.     cogs = 1; //one cog
  147.     t2c1 = (sH * cogs) + mH + (tuS * (toons - 1)) + tuM;
  148.     t2c1 = t2c1 * t2c1;
  149.     cout << "Combos with " << toons << " toons " << "and " << cogs << " cog: " << t2c1 << endl;
  150.  
  151.     cogs = 2; //two cogs
  152.     t2c2 = (sH * cogs) + mH + (tuS * (toons - 1)) + tuM;
  153.     t2c2 = t2c2 * t2c2; // for each one, other can chose all of their choices
  154.     cout << "Combos with " << toons << " toons " << "and " << cogs << " cogs: " << t2c2 << endl;
  155.    
  156.     cogs = 3; //three cogs
  157.     t2c3 = (sH * cogs) + mH + (tuS * (toons - 1)) + tuM; //total for 1 person
  158.     t2c3 = t2c3 * t2c3;
  159.     cout << "Combos with " << toons << " toons " << "and " << cogs << " cogs: " << t2c3 << endl;
  160.  
  161.     cogs = 4; //four cogs
  162.     t2c4 = (sH * cogs) + mH + (tuS * (toons - 1)) + tuM;
  163.     t2c4 = t2c4 * t2c4;
  164.     cout << "Combos with " << toons << " toons " << "and " << cogs << " cogs: " << t2c4 << endl;
  165.  
  166.     cout << "\n";
  167.     t2 = t2c1 + t2c2 + t2c3 + t2c4; //adds cog subtotals to subtotal of for 2 toons
  168.     cout << "The total possible combinations of gags with 2 toons: " << t2 << endl;
  169.     addT(t2); //adds partial of all of 2 toons to the grand total
  170.     cout << "The grand total of combinations is: " << Toontastic::getT() << "\n" << endl;
  171. }
  172.  
  173. void Toontastic::threeToons()
  174. {
  175.    
  176.     /*multi hit gags will only count 1 way not n ways for n cogs in the battle. These are: 4 toon up    gags, 4 lure gags, all (7) sound gags, 1 throw gag, 1 squirt gag, and 1 drop gag.
  177.     4 Toon Up
  178.     4 Lure
  179.     7 Sound
  180.     1 Throw
  181.     1 Squirt
  182.     1 Drop
  183.     18 Total Multi Hit Gags, 14 Total for 1 toon when not counting toon up.
  184.     31 Total Single Hit Gags, 24 Total for 1 toon when not counting toon up.
  185.     42 non toon up gags
  186.     7 toon up gags
  187.     */
  188.     int toons = 3;
  189.     const int tot = 49;
  190.     const int mH = 18;
  191.     const int sH = 24;
  192.     const int tuS = 3;
  193.     const int tuM = 4;
  194.     int cogs = 0;
  195.  
  196.     int t3 = 0;
  197.     int t3c1 = 0;
  198.     int t3c2 = 0;
  199.     int t3c3 = 0;
  200.     int t3c4 = 0;
  201.  
  202.     cogs = 1; //one cog
  203.     t3c1 = (sH * cogs) + mH + (tuS * (toons - 1)) + tuM;
  204.     t3c1 = t3c1 * t3c1 * t3c1;
  205.     cout << "Combos with " << toons << " toons " << "and " << cogs << " cog: " << t3c1 << endl;
  206.  
  207.     cogs = 2; //two cogs
  208.     t3c2 = (sH * cogs) + mH + (tuS * (toons - 1)) + tuM;
  209.     t3c2 = t3c2 * t3c2 * t3c2; // for each one, other can chose all of their choices
  210.     cout << "Combos with " << toons << " toons " << "and " << cogs << " cogs: " << t3c2 << endl;
  211.    
  212.     cogs = 3; //three cogs
  213.     t3c3 = (sH * cogs) + mH + (tuS * (toons - 1)) + tuM; //total for 1 person
  214.     t3c3 = t3c3 * t3c3 * t3c3;
  215.     cout << "Combos with " << toons << " toons " << "and " << cogs << " cogs: " << t3c3 << endl;
  216.  
  217.     cogs = 4; //four cogs
  218.     t3c4 = (sH * cogs) + mH + (tuS * (toons - 1)) + tuM;
  219.     t3c4 = t3c4 * t3c4 * t3c4;
  220.     cout << "Combos with " << toons << " toons " << "and " << cogs << " cogs: " << t3c4 << endl;
  221.  
  222.     cout << "\n";
  223.     t3 = t3c1 + t3c2 + t3c3 + t3c4; //adds cog subtotals to subtotal of for 2 toons
  224.     cout << "The total possible combinations of gags with 3 toons: " << t3 << endl;
  225.     addT(t3); //adds partial of all of 2 toons to the grand total
  226.     cout << "The grand total of combinations is: " << Toontastic::getT() << "\n" << endl;
  227. }
  228.  
  229. void Toontastic::fourToons()
  230. {
  231.    
  232.     /*multi hit gags will only count 1 way not n ways for n cogs in the battle. These are: 4 toon up    gags, 4 lure gags, all (7) sound gags, 1 throw gag, 1 squirt gag, and 1 drop gag.
  233.     4 Toon Up
  234.     4 Lure
  235.     7 Sound
  236.     1 Throw
  237.     1 Squirt
  238.     1 Drop
  239.     18 Total Multi Hit Gags, 14 Total for 1 toon when not counting toon up.
  240.     31 Total Single Hit Gags, 24 Total for 1 toon when not counting toon up.
  241.     42 non toon up gags
  242.     7 toon up gags
  243.     */
  244.     int toons = 4;
  245.     const int tot = 49;
  246.     const int mH = 18;
  247.     const int sH = 24;
  248.     const int tuS = 3;
  249.     const int tuM = 4;
  250.     int cogs = 0;
  251.  
  252.     int t4 = 0;
  253.     int t4c1 = 0;
  254.     int t4c2 = 0;
  255.     int t4c3 = 0;
  256.     int t4c4 = 0;
  257.  
  258.     cogs = 1; //one cog
  259.     t4c1 = (sH * cogs) + mH + (tuS * (toons - 1)) + tuM;
  260.     t4c1 = t4c1 * t4c1 * t4c1 * t4c1;
  261.     cout << "Combos with " << toons << " toons " << "and " << cogs << " cog: " << t4c1 << endl;
  262.  
  263.     cogs = 2; //two cogs
  264.     t4c2 = (sH * cogs) + mH + (tuS * (toons - 1)) + tuM;
  265.     t4c2 = t4c2 * t4c2 * t4c2 * t4c2; // for each one, other can chose all of their choices
  266.     cout << "Combos with " << toons << " toons " << "and " << cogs << " cogs: " << t4c2 << endl;
  267.    
  268.     cogs = 3; //three cogs
  269.     t4c3 = (sH * cogs) + mH + (tuS * (toons - 1)) + tuM; //total for 1 person
  270.     t4c3 = t4c3 * t4c3 * t4c3 * t4c3;
  271.     cout << "Combos with " << toons << " toons " << "and " << cogs << " cogs: " << t4c3 << endl;
  272.  
  273.     cogs = 4; //four cogs
  274.     t4c4 = (sH * cogs) + mH + (tuS * (toons - 1)) + tuM;
  275.     t4c4 = t4c4 * t4c4 * t4c4 * t4c4;
  276.     cout << "Combos with " << toons << " toons " << "and " << cogs << " cogs: " << t4c4 << endl;
  277.  
  278.     cout << "\n";
  279.     t4 = t4c1 + t4c2 + t4c3 + t4c4; //adds cog subtotals to subtotal of for 2 toons
  280.     cout << "The total possible combinations of gags with 4 toons: " << t4 << endl;
  281.     addT(t4); //adds partial of all of 2 toons to the grand total
  282.     cout << "The grand total of combinations is: " << Toontastic::getT() << "\n" << endl;
  283. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement