Probability, cells, and balls I have a Problem, I am trying to build a program that solves the game Minesweeper.
and I'm trying to find the probability of a bomb or a ball in each cell.
And I got stuck in a particular situation : 
Let's say I have 5 cells in a row, I know that in the first 3 cells there is 2 balls and I know that in the last 3 cells there is 2 balls.

What is the probability of the center cell to have a ball ?
I think it is 4/5 but I am not sure.
but there is Another situation more complicated :
I know the in the first 3 cells there 1 ball in the center 3 cells there is 1 ball and in the last 3 cells there is 1 ball.

What is the probability of the 3 center cells to have a ball ?
And how you found it ?

Situation 1
If the middle has a bomb, there is a bomb to each side of the middle thus making $4$ configurations. If the middle does not contain a bomb the remaining cells have to have bombs. This makes $1$ configuration. So indeed $\frac{4}{5}$ for the middle cell to contain a bomb. All other cells have bombs in $\frac{3}{5}$ of these. So it should be like this
$$
\begin{array}{|c|c|c|c|c|}
\hline
 & & & 2 &\\
\hline
\ \tfrac{3}{5}\ & \ \tfrac{3}{5}\ & \ \tfrac{4}{5}\ & \ \tfrac{3}{5}\ & \ \tfrac{3}{5}\ \\
\hline
& 2 & & &\\
\hline
\end{array}
$$
If we add these fractions we get $\frac{16}{5}=3.2$ which is indeed the average number of bombs in these five configurations.
Situation 2
If there is a bomb in the middle, there can be no more bombs. If there is a bomb to the left next to the middle, there must be a bomb to the very right. This configuration can be mirrored to get another one. So we have three configurations and each cell contains a ball in exactly one. So it is $\frac{1}{3}$ for all cells.
\begin{array}{|c|c|c|c|c|}
\hline
 & 1 & & 1 &\\
\hline
\ \tfrac{1}{3}\ & \ \tfrac{1}{3}\ & \ \tfrac{1}{3}\ & \ \tfrac{1}{3}\ & \ \tfrac{1}{3}\ \\
\hline
& & 1 & &\\
\hline
\end{array}
and the average of $\frac{5}{3}$ fits with the configurations.
