frankkarsten

Blue-Black Improvise Probability Calculation

Jan 16th, 2017
517
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. package heraldofanguish;
  3.  
  4. import java.util.Arrays.*;
  5. import java.util.Random;
  6.  
  7. public class HeraldOfAnguish {
  8.  
  9.     public static void main(String[] args) {
  10.        
  11.         Deck deck=new Deck();
  12.  
  13.         //CardType 1 is an Underground Sea (fetchable with Renegade Map)
  14.         //CardType 2 is a Cogworker's Puzzleknot or Servo Schematic
  15.         //CardType 3 is an Herald of Anguish
  16.         //CardType 4 is an Ornithopter
  17.         //CardType 5 is a Merchant's Dockhand
  18.         //CardType 6 is a Terrarion
  19.         //CardType 7 is a Renegade Map
  20.         //CardType 8 is an other card
  21.         //CardType 9 is a Reverse Engineer
  22.         //CardType 10 is a Heart of Kiran
  23.         //CardType 11 is a Aethersphere Harvester
  24.         //CardType 12 is not used
  25.        
  26.        
  27.         deck.SetDeck(22,7,4,5,3,2,2,11,2,1,1,0);
  28.        
  29.         int NumberOfIterations=50000000;
  30.         int StartingCards=7;
  31.         Deck remainingdeck=new Deck();
  32.         int NumberOfTurn2Heralds=0;
  33.         int NumberOfTurn3Heralds=0;
  34.         int NumberOfTurn4Heralds=0;
  35.         int NumberOfFail=0;
  36.         int NumberOfRelevantGames=0;
  37.         for (int IterationCounter=1; IterationCounter<=NumberOfIterations; IterationCounter++){
  38.             OpeningHand openinghand=GiveOpeningHandAfterMulls(deck, StartingCards);
  39.             remainingdeck.SetDeck(deck.NumberOfCardType1-openinghand.NumberOfCardType1,deck.NumberOfCardType2-openinghand.NumberOfCardType2,deck.NumberOfCardType3-openinghand.NumberOfCardType3,deck.NumberOfCardType4-openinghand.NumberOfCardType4,deck.NumberOfCardType5-openinghand.NumberOfCardType5,deck.NumberOfCardType6-openinghand.NumberOfCardType6,deck.NumberOfCardType7-openinghand.NumberOfCardType7,deck.NumberOfCardType8-openinghand.NumberOfCardType8,deck.NumberOfCardType9-openinghand.NumberOfCardType9,deck.NumberOfCardType10-openinghand.NumberOfCardType10,deck.NumberOfCardType11-openinghand.NumberOfCardType11,deck.NumberOfCardType12-openinghand.NumberOfCardType12);
  40.             int Outcome=SimulateGame(remainingdeck,openinghand);
  41.             if (Outcome==4) {NumberOfTurn4Heralds++; NumberOfRelevantGames++;}
  42.             if (Outcome==3) {NumberOfTurn3Heralds++; NumberOfRelevantGames++;}
  43.             if (Outcome==2) {NumberOfTurn2Heralds++; NumberOfRelevantGames++;}
  44.             if (Outcome==1) {NumberOfFail++; NumberOfRelevantGames++;}
  45.         }
  46.  
  47.         System.out.println("Probability of turn 2 Herald:"+Math.round(NumberOfTurn2Heralds/(NumberOfRelevantGames+0.0)*10000)/100.0);
  48.         System.out.println("Probability of turn 3 Herald:"+Math.round(NumberOfTurn3Heralds/(NumberOfRelevantGames+0.0)*10000)/100.0);
  49.         System.out.println("Probability of turn 4 Herald:"+Math.round(NumberOfTurn4Heralds/(NumberOfRelevantGames+0.0)*10000)/100.0);
  50.         System.out.println("Probability of not enough artifacts:"+Math.round(NumberOfFail/(NumberOfRelevantGames+0.0)*10000)/100.0);
  51.  
  52.     }//end of main
  53.    
  54.     static OpeningHand GiveOpeningHandAfterMulls (Deck deck, int StartingCards) {
  55.        
  56.         Deck remainingdeck=new Deck();
  57.         OpeningHand openinghand=new OpeningHand();
  58.         int TypeOfCardDrawn;
  59.         boolean KeepHand=false;
  60.        
  61.         for (int OpeningHandSize=7; OpeningHandSize>=1; OpeningHandSize--){
  62.             if (KeepHand==false){
  63.                 int NrLands=0;
  64.                 //Note: I view Springleaf Drum and Chrome Mox as lands as well here
  65.                 openinghand.SetHand(0,0,0,0,0,0,0,0,0,0,0,0);
  66.                 remainingdeck.SetDeck(deck.NumberOfCardType1,deck.NumberOfCardType2,deck.NumberOfCardType3,deck.NumberOfCardType4,deck.NumberOfCardType5,deck.NumberOfCardType6,deck.NumberOfCardType7,deck.NumberOfCardType8,deck.NumberOfCardType9,deck.NumberOfCardType10,deck.NumberOfCardType11,deck.NumberOfCardType12);
  67.                 for (int CardsDrawn=0; CardsDrawn<OpeningHandSize; CardsDrawn++){
  68.                     TypeOfCardDrawn=remainingdeck.DrawCard();
  69.                     if (TypeOfCardDrawn==1) {openinghand.NumberOfCardType1++; NrLands++;}
  70.                     if (TypeOfCardDrawn==2) {openinghand.NumberOfCardType2++; }
  71.                     if (TypeOfCardDrawn==3) {openinghand.NumberOfCardType3++; }
  72.                     if (TypeOfCardDrawn==4) {openinghand.NumberOfCardType4++; }
  73.                     if (TypeOfCardDrawn==5) {openinghand.NumberOfCardType5++; }
  74.                     if (TypeOfCardDrawn==6) {openinghand.NumberOfCardType6++;}
  75.                     if (TypeOfCardDrawn==7) {openinghand.NumberOfCardType7++; NrLands++;}
  76.                     if (TypeOfCardDrawn==8) {openinghand.NumberOfCardType8++;}
  77.                     if (TypeOfCardDrawn==9) {openinghand.NumberOfCardType9++;}
  78.                     if (TypeOfCardDrawn==10) {openinghand.NumberOfCardType10++;}
  79.                     if (TypeOfCardDrawn==11) {openinghand.NumberOfCardType11++;}
  80.                     if (TypeOfCardDrawn==12) {openinghand.NumberOfCardType12++;}
  81.                 }
  82.                 if (NrLands>=2 && NrLands<=5) {KeepHand=true;}
  83.             }
  84.         }
  85.        
  86.         return openinghand;
  87.     }//end of GiveOpeningHandAfterMulls
  88.    
  89.    
  90.     static int SimulateGame(Deck remainingdeck, OpeningHand openinghand) {
  91.        
  92.         int TypeOfCardDrawn;
  93.        
  94.         //CardType 1 is an Underground Sea (fetchable with Renegade Map)
  95.         //CardType 2 is a Cogworker's Puzzleknot or Servo Schematic
  96.         //CardType 3 is an Herald of Anguish
  97.         //CardType 4 is an Ornithopter
  98.         //CardType 5 is a Merchant's Dockhand
  99.         //CardType 6 is a Terrarion
  100.         //CardType 7 is a Renegade Map
  101.         //CardType 8 is an other card
  102.         //CardType 9 is a Reverse Engineer
  103.         //CardType 10 is a Heart of Kiran
  104.         //CardType 11 is a Aethersphere Harvester
  105.         //CardType 12 is not used
  106.        
  107.         int LandInHand=openinghand.NumberOfCardType1;
  108.         int PuzzleknotInHand=openinghand.NumberOfCardType2;
  109.         int HeraldInHand=openinghand.NumberOfCardType3;
  110.         int OrnithopterInHand=openinghand.NumberOfCardType4;
  111.         int OneDropInHand=openinghand.NumberOfCardType5;
  112.         int TerrarionInHand=openinghand.NumberOfCardType6;
  113.         int RenegadeMapInHand=openinghand.NumberOfCardType7;
  114.         int OtherInHand=openinghand.NumberOfCardType8;
  115.         int ReverseEngineerInHand=openinghand.NumberOfCardType9;
  116.         int HeartOfKiranInHand=openinghand.NumberOfCardType10;
  117.         int AethersphereHarvesterInHand=openinghand.NumberOfCardType11;
  118.        
  119.         int LandInPlay=0;
  120.         int TotalArtifactInPlay=0;
  121.         int TerrarionInPlay=0;
  122.         int RenegadeMapInPlay=0;
  123.         int TotalTapForHerald=0;
  124.         int Outcome=0;
  125.         int ManaAvailable=0;
  126.         int ArtifactsTapped=0;
  127.        
  128.         boolean LandPlayed;
  129.         boolean HeraldPlayed=false;
  130.         boolean PlayedReverseEngineerTurn4AndCouldntHavePlayedHeraldBeforeWithEnoughArtifacts=false;
  131.         boolean DebugMode=false;
  132.        
  133.         for (int Turn=1; Turn<=4; Turn++){
  134.                        
  135.             if (HeraldPlayed==false){
  136.                
  137.                 LandPlayed=false;
  138.                
  139.                 //We are always on the draw
  140.                
  141.                 TypeOfCardDrawn=remainingdeck.DrawCard();
  142.                 if (TypeOfCardDrawn==1) {LandInHand++;}
  143.                 if (TypeOfCardDrawn==2) {PuzzleknotInHand++;}
  144.                 if (TypeOfCardDrawn==3) {HeraldInHand++;}
  145.                 if (TypeOfCardDrawn==4) {OrnithopterInHand++;}
  146.                 if (TypeOfCardDrawn==5) {OneDropInHand++;}
  147.                 if (TypeOfCardDrawn==6) {TerrarionInHand++;}
  148.                 if (TypeOfCardDrawn==7) {RenegadeMapInHand++;}
  149.                 if (TypeOfCardDrawn==8) {OtherInHand++;}
  150.                 if (TypeOfCardDrawn==9) {ReverseEngineerInHand++;}
  151.                 if (TypeOfCardDrawn==10) {HeartOfKiranInHand++;}
  152.                 if (TypeOfCardDrawn==11) {AethersphereHarvesterInHand++;}
  153.                
  154.                 if(DebugMode) {
  155.                     System.out.print("Begin turn "+Turn+": hand is "+LandInHand+" land, "+PuzzleknotInHand+" Puzzleknot, "+HeraldInHand+" Heralds, "+OrnithopterInHand+" Ornithopters, "+OneDropInHand+" One-Drops, "+TerrarionInHand+" Terrarions, "+RenegadeMapInHand+" Renegade Map, "+OtherInHand+" Other, "+ReverseEngineerInHand+" Reverse Engineer, "+HeartOfKiranInHand+" Heart, "+AethersphereHarvesterInHand+" Aethersphere.");
  156.                     System.out.print(" Board is "+LandInPlay+" lands, "+TotalArtifactInPlay+" artifacts, of which "+ TerrarionInPlay+" Terrarion and "+RenegadeMapInPlay+" Renegade Map.");
  157.                 }
  158.                  
  159.                 //1. If we can play an Ornithopter, we do so
  160.                
  161.                 TotalArtifactInPlay=TotalArtifactInPlay+OrnithopterInHand;
  162.                 OrnithopterInHand=0;
  163.  
  164.                 //2. If we can play a land, we do so.
  165.                
  166.                 if (LandInHand>=1) {
  167.                     LandInHand--;
  168.                     LandInPlay++;
  169.                     LandPlayed=true;
  170.                 }
  171.  
  172.                 //2a. If we can play a Herald, we do so.
  173.  
  174.                 TotalTapForHerald=LandInPlay+TotalArtifactInPlay;
  175.                
  176.                 if (TotalTapForHerald>=7 && HeraldInHand>=1) {
  177.                     HeraldPlayed=true;
  178.                     Outcome=Turn;
  179.                 }
  180.                        
  181.                 //3. If we haven't played a land yet, we try to use Renegade Map and/or Terrarion
  182.                
  183.                 if (LandPlayed==false && RenegadeMapInPlay>=1) {
  184.                         RenegadeMapInPlay--;
  185.                         TotalArtifactInPlay--;
  186.                         remainingdeck.NumberOfCardType1--;
  187.                         LandInHand++;      
  188.                         LandInHand--;
  189.                         LandInPlay++;
  190.                         LandPlayed=true;
  191.                         if(DebugMode) {System.out.print("Crack Map. ");}
  192.                     }
  193.  
  194.                 if (LandPlayed==false && TerrarionInPlay>=1 && LandInPlay>=2) {
  195.                     TerrarionInPlay--;
  196.                     TotalArtifactInPlay--;
  197.                     TypeOfCardDrawn=remainingdeck.DrawCard();
  198.                     if(DebugMode) {System.out.print("Crack Terrarion for");}
  199.                     if (TypeOfCardDrawn==1) {LandInHand++; if(DebugMode){System.out.print(" land.");}}
  200.                     if (TypeOfCardDrawn==2) {PuzzleknotInHand++; if(DebugMode){System.out.print(" Puzz.");}}
  201.                     if (TypeOfCardDrawn==3) {HeraldInHand++; if(DebugMode){System.out.print(" Herald.");}}
  202.                     if (TypeOfCardDrawn==4) {OrnithopterInHand++; if(DebugMode){System.out.print(" for 0/2.");}}
  203.                     if (TypeOfCardDrawn==5) {OneDropInHand++; if(DebugMode){System.out.print(" one-drop.");}}
  204.                     if (TypeOfCardDrawn==6) {TerrarionInHand++; if(DebugMode){System.out.print(" Terr.");}}
  205.                     if (TypeOfCardDrawn==7) {RenegadeMapInHand++; if(DebugMode){System.out.print(" RenMap.");}}
  206.                     if (TypeOfCardDrawn==8) {OtherInHand++; if(DebugMode){System.out.print(" other.");}}
  207.                     if (TypeOfCardDrawn==9) {ReverseEngineerInHand++; if(DebugMode){System.out.print(" RevEng.");}}
  208.                     if (TypeOfCardDrawn==10) {HeartOfKiranInHand++; if(DebugMode){System.out.print(" Heart.");}}
  209.                     if (TypeOfCardDrawn==11) {AethersphereHarvesterInHand++; if(DebugMode){System.out.print(" Aethersphere.");}}
  210.                    
  211.                     if (LandInHand>=1) {
  212.                         LandInHand--;
  213.                         LandInPlay++;
  214.                         LandPlayed=true;
  215.                     }
  216.                 }
  217.                
  218.                 //3a. If we can play a Herald, we do so.
  219.  
  220.                 TotalTapForHerald=LandInPlay+TotalArtifactInPlay;
  221.                
  222.                 if (TotalTapForHerald>=7 && HeraldInHand>=1) {
  223.                     HeraldPlayed=true;
  224.                     Outcome=Turn;
  225.                 }
  226.                
  227.                 //4. We cast artifacts that don't enter tapped
  228.                
  229.                 ManaAvailable=LandInPlay;
  230.                
  231.                 if (ManaAvailable>=2 && PuzzleknotInHand>=1) {
  232.                     ManaAvailable=ManaAvailable-2;
  233.                     PuzzleknotInHand--;
  234.                     TotalArtifactInPlay=TotalArtifactInPlay+2;
  235.                 }
  236.                
  237.                 if (ManaAvailable>=1 && OneDropInHand>=1) {
  238.                     int CastableOneDrops=Math.min(ManaAvailable,OneDropInHand);
  239.                     ManaAvailable=ManaAvailable-CastableOneDrops;
  240.                     OneDropInHand=OneDropInHand-CastableOneDrops;
  241.                     TotalArtifactInPlay=TotalArtifactInPlay+CastableOneDrops;
  242.                 }
  243.                
  244.                 if (ManaAvailable>=2 && HeartOfKiranInHand>=1) {
  245.                     ManaAvailable=ManaAvailable-2;
  246.                     HeartOfKiranInHand--;
  247.                     TotalArtifactInPlay++;
  248.                 }
  249.                
  250.                 if (ManaAvailable>=3 && AethersphereHarvesterInHand>=1) {
  251.                     ManaAvailable=ManaAvailable-3;
  252.                     AethersphereHarvesterInHand--;
  253.                     TotalArtifactInPlay++;
  254.                 }
  255.  
  256.                
  257.                 //5. We cast ReverseEngineer if possible
  258.                
  259.                 ArtifactsTapped=0;
  260.                
  261.                 if (ManaAvailable>=2 && ReverseEngineerInHand>=1 && TotalArtifactInPlay+ManaAvailable>=5) {
  262.                     if (TotalArtifactInPlay>=3){
  263.                         ManaAvailable=ManaAvailable-2;
  264.                         ArtifactsTapped=3;
  265.                     }
  266.                     if (TotalArtifactInPlay==2){
  267.                         ManaAvailable=ManaAvailable-3;
  268.                         ArtifactsTapped=2;
  269.                     }
  270.                     ReverseEngineerInHand--;
  271.                     if (Turn==4) {PlayedReverseEngineerTurn4AndCouldntHavePlayedHeraldBeforeWithEnoughArtifacts=true;}
  272.                     if (Turn==4 && TotalTapForHerald<7 && HeraldInHand>=1) {PlayedReverseEngineerTurn4AndCouldntHavePlayedHeraldBeforeWithEnoughArtifacts=false;}
  273.                     if(DebugMode) {System.out.print("RevEng into");}
  274.                     for (int CardsDrawn=1; CardsDrawn<=3; CardsDrawn++){
  275.                         TypeOfCardDrawn=remainingdeck.DrawCard();
  276.                         if (TypeOfCardDrawn==1) {LandInHand++; if(DebugMode){System.out.print(" land.");}}
  277.                         if (TypeOfCardDrawn==2) {PuzzleknotInHand++; if(DebugMode){System.out.print(" Puzz.");}}
  278.                         if (TypeOfCardDrawn==3) {HeraldInHand++; if(DebugMode){System.out.print(" Herald.");}}
  279.                         if (TypeOfCardDrawn==4) {OrnithopterInHand++; if(DebugMode){System.out.print(" for 0/2.");}}
  280.                         if (TypeOfCardDrawn==5) {OneDropInHand++; if(DebugMode){System.out.print(" one-drop.");}}
  281.                         if (TypeOfCardDrawn==6) {TerrarionInHand++; if(DebugMode){System.out.print(" Terr.");}}
  282.                         if (TypeOfCardDrawn==7) {RenegadeMapInHand++; if(DebugMode){System.out.print(" RenMap.");}}
  283.                         if (TypeOfCardDrawn==8) {OtherInHand++; if(DebugMode){System.out.print(" other.");}}
  284.                         if (TypeOfCardDrawn==9) {ReverseEngineerInHand++; if(DebugMode){System.out.print(" RevEng.");}}
  285.                     }
  286.                 }
  287.                
  288.                 //5a. If we can play a land or Ornithopter, we do so.
  289.                
  290.                 if (LandInHand>=1 && LandPlayed==false) {
  291.                     LandInHand--;
  292.                     LandInPlay++;
  293.                     ManaAvailable++;
  294.                     LandPlayed=true;
  295.                 }
  296.                
  297.                 TotalArtifactInPlay=TotalArtifactInPlay+OrnithopterInHand;
  298.                 OrnithopterInHand=0;
  299.                
  300.                 //5b. If we can play a Herald, we do so.
  301.  
  302.                 TotalTapForHerald=ManaAvailable+TotalArtifactInPlay-ArtifactsTapped;
  303.                
  304.                 if (TotalTapForHerald>=7 && HeraldInHand>=1) {
  305.                     HeraldPlayed=true;
  306.                     Outcome=Turn;
  307.                 }
  308.                
  309.                 //6. We cast Terrarion or Renegade map
  310.                
  311.                 if (ManaAvailable>=1 && RenegadeMapInHand>=1) {
  312.                     ManaAvailable=ManaAvailable-1;
  313.                     RenegadeMapInHand--;
  314.                     TotalArtifactInPlay++;
  315.                     RenegadeMapInPlay++;
  316.                 }
  317.                
  318.                 if (ManaAvailable>=1 && TerrarionInHand>=1) {
  319.                     ManaAvailable=ManaAvailable-1;
  320.                     TerrarionInHand--;
  321.                     TotalArtifactInPlay++;
  322.                     TerrarionInPlay++;
  323.                 }
  324.                
  325.                 if(DebugMode) { System.out.println();}
  326.             }//end of not HeraldPlayed check
  327.                        
  328.         }//end of the for-loop over the turns
  329.        
  330.         if (HeraldPlayed==false && HeraldInHand>=1 && LandInPlay>=4 && PlayedReverseEngineerTurn4AndCouldntHavePlayedHeraldBeforeWithEnoughArtifacts==false) {Outcome=1;}
  331.        
  332.         if(DebugMode){
  333.             System.out.println("====Outcome: "+Outcome);
  334.             System.out.println();
  335.         }
  336.        
  337.         return Outcome;
  338.        
  339.     }//end of SimulateGame
  340.    
  341.  
  342. }
  343.  
  344. class OpeningHand {
  345.     int NumberOfCardType1;
  346.     int NumberOfCardType2;
  347.     int NumberOfCardType3;
  348.     int NumberOfCardType4;
  349.     int NumberOfCardType5;
  350.     int NumberOfCardType6;
  351.     int NumberOfCardType7;
  352.     int NumberOfCardType8;
  353.     int NumberOfCardType9;
  354.     int NumberOfCardType10;
  355.     int NumberOfCardType11;
  356.     int NumberOfCardType12;
  357.     //I really should've used arrays here, lol
  358.  
  359.     int NrOfCards(){
  360.         return NumberOfCardType1+NumberOfCardType2+NumberOfCardType3+NumberOfCardType4+NumberOfCardType5+NumberOfCardType6+NumberOfCardType7+NumberOfCardType8+NumberOfCardType9+NumberOfCardType10+NumberOfCardType11+NumberOfCardType12;
  361.     }
  362.  
  363.     void SetHand (int Nr1, int Nr2, int Nr3, int Nr4, int Nr5, int Nr6, int Nr7, int Nr8, int Nr9, int Nr10, int Nr11, int Nr12) {
  364.         NumberOfCardType1=Nr1;
  365.         NumberOfCardType2=Nr2;
  366.         NumberOfCardType3=Nr3;
  367.         NumberOfCardType4=Nr4;
  368.         NumberOfCardType5=Nr5;
  369.         NumberOfCardType6=Nr6;
  370.         NumberOfCardType7=Nr7;
  371.         NumberOfCardType8=Nr8;
  372.         NumberOfCardType9=Nr9;
  373.         NumberOfCardType10=Nr10;
  374.         NumberOfCardType11=Nr11;
  375.         NumberOfCardType11=Nr12;
  376.     }
  377.  
  378. }//end of OpeningHand
  379.  
  380. class Deck {
  381.     int NumberOfCardType1;
  382.     int NumberOfCardType2;
  383.     int NumberOfCardType3;
  384.     int NumberOfCardType4;
  385.     int NumberOfCardType5;
  386.     int NumberOfCardType6;
  387.     int NumberOfCardType7;
  388.     int NumberOfCardType8;
  389.     int NumberOfCardType9;
  390.     int NumberOfCardType10;
  391.     int NumberOfCardType11;
  392.     int NumberOfCardType12;
  393.     //I really should've used arrays here, lol
  394.  
  395.     void SetDeck (int Nr1, int Nr2, int Nr3, int Nr4, int Nr5, int Nr6, int Nr7, int Nr8, int Nr9, int Nr10, int Nr11, int Nr12) {
  396.         NumberOfCardType1=Nr1;
  397.         NumberOfCardType2=Nr2;
  398.         NumberOfCardType3=Nr3;
  399.         NumberOfCardType4=Nr4;
  400.         NumberOfCardType5=Nr5;
  401.         NumberOfCardType6=Nr6;
  402.         NumberOfCardType7=Nr7;
  403.         NumberOfCardType8=Nr8;
  404.         NumberOfCardType9=Nr9;
  405.         NumberOfCardType10=Nr10;
  406.         NumberOfCardType11=Nr11;
  407.         NumberOfCardType12=Nr12;
  408.     }
  409.    
  410.     int NrOfCards(){
  411.         return NumberOfCardType1+NumberOfCardType2+NumberOfCardType3+NumberOfCardType4+NumberOfCardType5+NumberOfCardType6+NumberOfCardType7+NumberOfCardType8+NumberOfCardType9+NumberOfCardType10+NumberOfCardType11+NumberOfCardType12;
  412.     }
  413.    
  414.     int DrawCard (){
  415.         Random generator = new Random();
  416.         int CardType=0;
  417.         int RandomIntegerBetweenOneAndDeckSize=generator.nextInt( this.NrOfCards() )+1;
  418.         int OneCutoff=NumberOfCardType1;
  419.         int TwoCutoff=OneCutoff+NumberOfCardType2;
  420.         int ThreeCutoff=TwoCutoff+NumberOfCardType3;
  421.         int FourCutoff=ThreeCutoff+NumberOfCardType4;
  422.         int FiveCutoff=FourCutoff+NumberOfCardType5;
  423.         int SixCutoff=FiveCutoff+NumberOfCardType6;
  424.         int SevenCutoff=SixCutoff+NumberOfCardType7;
  425.         int EightCutoff=SevenCutoff+NumberOfCardType8;
  426.         int NineCutoff=EightCutoff+NumberOfCardType9;
  427.         int TenCutoff=NineCutoff+NumberOfCardType10;
  428.         int ElevenCutoff=TenCutoff+NumberOfCardType11;
  429.         int TwelveCutoff=ElevenCutoff+NumberOfCardType12;
  430.        
  431.         if (RandomIntegerBetweenOneAndDeckSize<=OneCutoff) {CardType=1; this.NumberOfCardType1--;}
  432.         if (RandomIntegerBetweenOneAndDeckSize>OneCutoff && RandomIntegerBetweenOneAndDeckSize<=TwoCutoff) {CardType=2; this.NumberOfCardType2--;}
  433.         if (RandomIntegerBetweenOneAndDeckSize>TwoCutoff && RandomIntegerBetweenOneAndDeckSize<=ThreeCutoff) {CardType=3; this.NumberOfCardType3--;}
  434.         if (RandomIntegerBetweenOneAndDeckSize>ThreeCutoff && RandomIntegerBetweenOneAndDeckSize<=FourCutoff) {CardType=4; this.NumberOfCardType4--;}
  435.         if (RandomIntegerBetweenOneAndDeckSize>FourCutoff && RandomIntegerBetweenOneAndDeckSize<=FiveCutoff) {CardType=5; this.NumberOfCardType5--;}
  436.         if (RandomIntegerBetweenOneAndDeckSize>FiveCutoff && RandomIntegerBetweenOneAndDeckSize<=SixCutoff) {CardType=6; this.NumberOfCardType6--;}
  437.         if (RandomIntegerBetweenOneAndDeckSize>SixCutoff && RandomIntegerBetweenOneAndDeckSize<=SevenCutoff) {CardType=7; this.NumberOfCardType7--;}
  438.         if (RandomIntegerBetweenOneAndDeckSize>SevenCutoff && RandomIntegerBetweenOneAndDeckSize<=EightCutoff) {CardType=8; this.NumberOfCardType8--;}
  439.         if (RandomIntegerBetweenOneAndDeckSize>EightCutoff && RandomIntegerBetweenOneAndDeckSize<=NineCutoff) {CardType=9; this.NumberOfCardType9--;}
  440.         if (RandomIntegerBetweenOneAndDeckSize>NineCutoff && RandomIntegerBetweenOneAndDeckSize<=TenCutoff) {CardType=10; this.NumberOfCardType10--;}
  441.         if (RandomIntegerBetweenOneAndDeckSize>TenCutoff && RandomIntegerBetweenOneAndDeckSize<=ElevenCutoff) {CardType=11; this.NumberOfCardType11--;}
  442.         if (RandomIntegerBetweenOneAndDeckSize>ElevenCutoff && RandomIntegerBetweenOneAndDeckSize<=TwelveCutoff) {CardType=12; this.NumberOfCardType12--;}
  443.  
  444.         return CardType;
  445.     }
  446.    
  447. }//end of Deck
RAW Paste Data