Question: I've been trying different methods to fix my code but cant find the error. I keep getting 0 % or 1 0 0 % based
I've been trying different methods to fix my code but cant find the error. I keep getting or based on bricked or not bricked.
What were trying to find is the conditional probability of given that youve already drawn a valid hand that has a pokemon in it what are the odds that all of your rare candies got drawn in the prizes which bricked
public void RareCandyDeck
resetDeck;
resetHand;
int totalDeckSize ;
int rareCandyCount ;
int pokemonCount totalDeckSize rareCandyCount;
for int i ; i pokemonCount; i
deck.addnew Pokemonpikachu;
forint i; i rareCandyCount; i
deck.addnew TrainerrareCandy;
Collections.shuffledeck;
public void rareCandySimulator
for int i ; i ; i
int notBricked ;
int bricked ;
int trials ;
for int j ; j trials; j
boolean validHand false;
while validHand
resetHand;
resetDeck;
RareCandyDeck;
drawHand;
if isHandValid
validHand true;
if decksize
for int k ; k ; k
prizePile.adddeckremove;
else
resetHand;
drawHand;
int candiesinPrizePile ;
for Card card : prizePile
if cardgetNameequalsrareCandy
candiesinPrizePile;
if candiesinPrizePile
bricked;
else
notBricked;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
