How to make two Coins toss probabilities change simultaneously? Hello , I am trying to make a coin toss game where the probabilities decrase by 1/2 everytime the same face of the coin appears and in the same time increases by that amount for the other face
exemple:
heads 0 - tails 0 ---> Probabilities : 50% 50% 
heads 1 - tails 0 ---> Probabilities : 25% 75% 
heads 2 - tails 0 ---> Probabilities : 12.5% 87.5% 
heads 2 - tails 1 ---> Probabilities : 25% 75%
heads 2 - tails 2 ---> Probabilities : 50% 50%
heads 2 - tails 3 ---> Probabilities : 75% 25%
etc...

To make this happen I made two variable , headtimes(how many times heads appeared) and tailtimes(how many times appeared) , and I used the following formula to get the percentage of each (the initial chances are 50% 50%):
headstats = 50/2^(headtimes-tailtimes) 
tailstats = 100-headstats

But it is not functional , as the probabilities jump directly to 100 if the first toss is tails  50/2^(0-1)
Sorry for my bad english epression and thank you already
 A: If I get what you're saying correctly I guess what you need is the following:(H,T are Headtimes and Tailtimes respectively)
$Headstats=( \frac{1}{2}-sgn(H-T)*(\frac{1}{2}-2^{-|H-T|-1}))*100$
$Tailstats=100-Headstats$
A: WLOG the number of turns that have already occurred that have been recorded as Heads (= H) is greater than or equal to the number of turns that have already occurred that have been recorded as Tails (= T).
Then, you want that the chance of a Heads being recorded on the next turn to be  $\frac{1}{2^{(H+1-T)}}.$
Clearly you will want the chance of a Tails being recorded on the next turn to be 1 - (the chance of a Heads being recorded on the next turn).
The easiest way to do that is to re-define a turn as follows:
Assuming that $(H + 1 - T) \geq 1,$ a Heads will be registered for the turn if and only if, on this turn, when a coin is tossed (H + 1 - T) times, it comes up heads each time.
If so, the H(eads) is recorded for this turn.  If not, a T(ails) is recorded for this turn.
Then, you move on to the next turn.
Addendum
Responding to the OP's comment:

...but I have to do it with only one formula , not an algorithm

Unclear what you intend here.  I'll take a stab at it.  Let me know if I have misinterpreted your comment.
Assume that the number of turns $=N$ is a known value.
Assume that the number of Heads ($H$'s) that have been recorded on these $N$ turns is also a known value.
You can eliminate any consideration of which turns have been recorded as Tails in the following manner:

*

*On a given turn, compute $D = (2H - N)$ and flip a coin $|D| + 1$ times.


*If $D \geq 0$ record Heads on the turn only if all $|D| + 1$ coin flips come up heads.


*If $D < 0$ record Heads on the turn if any of the
$|D| + 1$ coin flips come up heads.
Is this what you were looking for?
