This summer I learned a new card game called "To Hell and Back". Similar to
"Oh Hell" and "Rats!", "To Hell and Back" is a trick-taking card game where you
bid the number of tricks you intend to take, and you must take *exactly* that
number of tricks per hand in order to win. Bid correctly, and you earn your bid
and 10 extra points. Lose your bid and you get zilch. Unlike its other
variations, "To Hell and Back" starts with all players being dealt one card,
and each hand the number of cards dealt per hand increases until we hit our
maximum for all players. In the case of one-card hands, the differences between
success and failure are luck of the draw and careful bidding.

I've become fascinated with this one-card case. To better understand the odds of winning this specific scenario, I've constructed a hand simulator, wherein a group of players are dealt one card, and the winner is determined. Using this simulation, we can understand just how likely each card and position is to win a hand.

## Simulating The Game

Let's begin by constructing a vector for the deck of cards. A deck in this case is just a data frame consisting of suits and values.

```
deck <- c()
for (suit in c('H','D','C','S')) {
for (value in seq(1,13)) {
deck <- rbind(deck, c(suit=suit, value=value))
}
}
deck <- data.frame(deck)
deck$value <- as.numeric(deck$value)
```

Now that we have a deck, let's deal out the cards. Along the way we'll reveal the trump suit.

```
# Deal out cards
dealt_cards <- deck[sample(1:nrow(deck), 6, replace=F),]
# identify trump
trump_suit <- dealt_cards$suit[1]
```

Now that we've dealt some cards and identified trump, let's identify the leading suit and score up the hands. For each trick, the card with the highest score wins, with preference being given to cards of the trump suit over the leading suit.

```
# Identify leading suit
leading_suit <- dealt_cards$suit[2]
# Score each player. If your suit is not the leading suit or trump, than you
# get 0 points. If it's trump, then we will bias in your favor.
# (dealt_cards$value + ifelse(dealt_cards$suit == trump_suit, 20, 0))
dealt_cards <- dealt_cards %>%
mutate(scored = ifelse(dealt_cards$suit == leading_suit, 1, 0) +
ifelse(dealt_cards$suit == trump_suit, 1, 0)) %>%
mutate(score = ifelse(scored > 0, dealt_cards$value +
ifelse(dealt_cards$suit == trump_suit, 20, 0) , 0))
# Identify the winner
winning_player <- which.max(dealt_cards$score[2:6]) + 1
winning_hand <- dealt_cards[winning_player,]
```

We can then store the winning card, whether it was trump, and the position of the winner among players.

Using this basic hand simulation, I ran 10,000 simulations of "To Hell and Back"
to quantify the probability of winning given any hand. With this in *(ahem)*
hand, I investigated what the probability of a win was with respect to having a
trump card, the value of a non-trump card, and based on your position in the
order of players.

## Trump vs Non-Trump

First, let's see how having a trump card affects the likelihood of winning the hand. Based on the 10,000 simulations performed, in about 75% of winners had a trump card, and of players with a trump card about 65% win the hand. Based on an odds ratio, in a 5-player game any given player is 10x more likely to win a one-card hand if they have a trump card than those who do not.

```
results %>%
group_by(is_trump, winner) %>%
summarise(count = n()) %>%
mutate(freq=count/sum(count))
```

## Trump Win Scenarios

Since having a trump card is such a strong indicator of winning a one-card hand, let's examine how player position and card value affect the probability of winning. Unsurprisingly, higher-valued trump cards are associated with a larger proportion of winning hands. Starting from a base proportion of 33% of hands being won by a player with a two of trump, the probability of winning increases to a 100% win rate for aces.

Of particular note, as shown in the figure below, is that there is not a strong relationship between player position and winning if the player has a trump card. This is likely a result of there being too few cards in play for multiple players to both have trump cards. Futhermore, since trump cards are so much more likely to win than non-trump cards, the trump card is more likely to beat a non-trump leading card.

```
scores_by_player <- results %>%
dplyr::rename(score=value)%>%
group_by(score, is_trump, player, winner) %>%
summarise(count = n()) %>%
mutate(freq=count/sum(count)) %>%
select(score, is_trump, player, winner, freq) %>%
filter(winner == 1, is_trump == 1) %>%
cast(score ~ player)
```

## Non-Trump Win Scenarios

Next, let's see how the same hands play out for non-trump scenarios. Much like the trump card scenarios, there is a strong positive relationship between card value and the probability of winning (Metric), starting from a probability of 0.07 increasing up to a probability of 0.31 for the first player in the hand. Unlike the trump card scenarios, however, player position has a strong affect on the player's chance of winning. as shown in the figure below, the first player is 3-5 times more likely to win a hand than all other positions regardless of card value.

```
scores_by_player <- results %>%
dplyr::rename(score=value)%>%
group_by(score, is_trump, player, winner) %>%
summarise(count = n()) %>%
mutate(freq=count/sum(count)) %>%
select(score, is_trump, player, winner, freq) %>%
filter(winner == 1, is_trump == 0) %>%
cast(score ~ player)
```

## Conclusions

Using these simulations as guideposts for bidding behavior, I present the following heuristic.

Is this perfect? Not even close! It should be said, however, that this will make your decisions rather easy in the first round. In any case, "To Hell and Back" is just a means to have fun, and what's more fun than clawing victory from the jaws of defeat?