# Hi-Lo, what's the probability of winning

**URL:** <https://boards.straightdope.com/t/hi-lo-whats-the-probability-of-winning/791471>\
**Category:** Factual Questions\
**Created:** [July 17, 2017, 6:57am UTC](https://boards.straightdope.com/t/hi-lo-whats-the-probability-of-winning/791471 "2017-07-17T06:57:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr\_Shine](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/mr_shine/32/464_2.png) [@Mr\_Shine](https://boards.straightdope.com/u/Mr_Shine)\
**Post date:** [July 17, 2017, 6:57am UTC](https://boards.straightdope.com/t/hi-lo-whats-the-probability-of-winning/791471/1 "2017-07-17T06:57:49Z")

</div>

There’s a game that works like this. You choose a random card from 13, ranked 2-A, bet on whether the next card will be higher or lower. If you’re right, the first card is returned to the deck, which is then fully shuffled and you have to guess whether the next card is higher or lower than the second card. Repeat this process until you’ve got 1 wrong or 5 right. What are the odds you win, assuming you play the odds, (always high 2-7, always low 9-A)?

---

<div class="post-metadata">

**Author:** ![naita](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/naita/32/5862_2.png) [@naita](https://boards.straightdope.com/u/naita)\
**Post date:** [July 17, 2017, 7:58am UTC](https://boards.straightdope.com/t/hi-lo-whats-the-probability-of-winning/791471/2 "2017-07-17T07:58:18Z")

</div>

I think that’s the sort of problem where you just have to run every possible option.

---

<div class="post-metadata">

**Author:** ![septimus](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/septimus/32/410_2.png) [@septimus](https://boards.straightdope.com/u/septimus)\
**Post date:** [July 17, 2017, 9:52am UTC](https://boards.straightdope.com/t/hi-lo-whats-the-probability-of-winning/791471/3 "2017-07-17T09:52:58Z")

</div>

The deck has only 13 cards so there is no worry about ties.

On the _first_ round your chance of success is 10/13 ~= 0.769231. If this were your chance _every_ round, your chance of winning the first five rounds would be (10/13)^5 ~= 0.269329.

But subsequent rounds have lower odds. You want the control card to be a very high card or a very low card. For the initial round, an Ace or a Deuce is as likely as a Seven or Eight, but on subsequent _winning_ rounds, Seven is about twice as likely as Ace. (Seven always wins, while Ace loses half the time. Turning up a medium card makes it _more_ likely you win this round, but _less_ likely you win the next round when that medium card becomes the control card.)

I don’t know any shortcut to get an exact expression so I followed **naita** ’s suggestion and counted every single possibility. You get five wins with no losses with probability 740923/3234816 ~= 0.229046

---

<div class="post-metadata">

**Author:** ![naita](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/naita/32/5862_2.png) [@naita](https://boards.straightdope.com/u/naita)\
**Post date:** [July 17, 2017, 11:49am UTC](https://boards.straightdope.com/t/hi-lo-whats-the-probability-of-winning/791471/4 "2017-07-17T11:49:17Z")

</div>

That’s what I got too, once I went through my script to see why I didn’t get the same result. Turns out I only went to 4 wins.

---

<div class="post-metadata">

**Author:** ![Lance\_Turbo](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/lance_turbo/32/6156_2.png) [@Lance\_Turbo](https://boards.straightdope.com/u/Lance_Turbo)\
**Post date:** [July 17, 2017, 6:54pm UTC](https://boards.straightdope.com/t/hi-lo-whats-the-probability-of-winning/791471/5 "2017-07-17T18:54:29Z")

</div>

I’ll show you my script if you show me yours.

Python 3

```auto

def hilo(n, k):
    vec = [1.0] * n
    while k:
        vec = [max(sum(vec[i+1:])/(n-1), sum(vec[:i])/(n-1)) for i, x in enumerate(vec)]
        k -= 1
    return sum(vec)/n
    
print(hilo(13, 5))

```

It’s a function that gives the win probability for a deck of n cards where we need k successes to win.

It should be cut and pastable into this [online Python 3 interpreter](http://repl.it/languages/python3) if you wish to play around with it.

---

<div class="post-metadata">

**Author:** ![Lance\_Turbo](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/lance_turbo/32/6156_2.png) [@Lance\_Turbo](https://boards.straightdope.com/u/Lance_Turbo)\
**Post date:** [July 17, 2017, 7:10pm UTC](https://boards.straightdope.com/t/hi-lo-whats-the-probability-of-winning/791471/6 "2017-07-17T19:10:19Z")

</div>

I just realized my loop control was unnecessarily complicated. I cleaned it up a bit so it would be less distracting.

```auto

def hilo(n, k):
    vec = [1.0] * n
    while k:
        vec = [max(sum(vec[i+1:])/(n-1), sum(vec[:i])/(n-1)) for i in range(n)]
        k -= 1
    return sum(vec)/n
    
print(hilo(13, 5))

```
