Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ScrabbleBet {
- public double estimate(int trials, int games, int winsNeeded, int winChance)
- {
- int total = (int)Math.pow(2, games);
- double numWin = 0;
- double lose = (100 - winChance)/100.0;
- double loseC = 0;
- for (int i = 0; i < winsNeeded; i++)
- {
- loseC += (Math.pow(winsNeeded/100.0, i) + Math.pow(lose, games - i));
- }
- System.out.println(loseC);
- return 1 - Math.pow(loseC, trials);
- }
- public static void main(String[] args)
- {
- System.out.println(new ScrabbleBet().estimate(2, 2, 1, 50));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement