All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Probability
Scratch a Home Run! (Posted on 2005-10-18) Difficulty: 2 of 5
A scratch game has 16 covered squares, below which are, in some order, symbols representing 9 players (a pitcher, a catcher, and so on), 3 strikes (strike 1, strike 2, and strike 3), 1 hit, 1 home run, 1 bat, and 1 ball.

You start scratching squares randomly, and if you manage to get the hit and the home run you win (never mind other symbols) unless you already got the three strikes, because then you're out!

What are the odds of winning at this game?

Computer solutions welcome!

See The Solution Submitted by e.g.    
Rating: 2.0000 (3 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Independent solution | Comment 8 of 9 |

First, I'd like to propose the removal of all purposeless symbols from our considerations.  It may not be immediately obviously to everyone, but they do not at all affect the calculations.

Let's just say that I scratch all the squares, rather than stopping when I win or lose.  I can take any of the 5! possible permu
tations, each of which is equally likely, and determine whether I win or lose first by looking at the last square I scratch.  If the last square is a strike, I've won.  If the last square is a hit or home run, then I've lost.  Exactly 3/5 of the 5! permutations will cause me to win.  Therefore, I have exactly 60% chance to win.

Since bold lettering always stands out, I've also written a java program to estimate the probability.  I don't yet know how to calculate standard deviations though. :(

// ScratchBaseball.java
// Estimates the probability of winning a game of scratch baseball
// Tristan 10/18/05

// java packages
import javax.swing.JOptionPane;
import javax.swing.JTextArea;

public class ScratchBaseball
{
public static void main( String args[] )
{
String repeat = ""; // User's choice whether to repeat
JTextArea output = new JTextArea();

final int numberTrials = 100000;
// number of trials to perform for each repeat of the program
int trial = 0; // trial counter
int trialTotal = 0; // total number of trials performed
int squares = 16; // total number of unscratched squares
int homerun = 0; // number of winning squares scratched
int strike = 0; // number of strikes scratched
int winCtr = 0; // winning trials
int loseCtr = 0; // losing trials
int guess = 0; // square to be scratched

do
{
trial = 0;

while( trial < numberTrials )
{
squares = 16;
homerun = 0;
strike = 0;

while( homerun < 2 && strike < 3 )
{
guess = 1 + (int) ( Math.random() * squares-- );

if( guess <= 2 - homerun )
homerun++;
else if( guess <= 5 - homerun - strike )
strike++;
}

if( homerun == 2 )
winCtr++;
else
loseCtr++;

trial++;
}

trialTotal += numberTrials;

output.setText( "Trials:\t" + trialTotal +
"\nWins:\t" + winCtr + "\nLosses:\t" + loseCtr +
"\nWin probability:\t" +
( (double) winCtr / (double) trialTotal ) );

JOptionPane.showMessageDialog( null, output, "Results",
JOptionPane.PLAIN_MESSAGE );

repeat = JOptionPane.showInputDialog(
"Type 0 if you would like to repeat the program" );

} while( repeat.equals( "0" ) );

System.exit( 0 );

} // end main method
} // end public class


Results
Trials:    100000
Wins:    60069
Losses:    39931
Win probability:    0.60069


  Posted by Tristan on 2005-10-18 20:03:51
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (19)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information