It is a binary game similar to a coin toss. Player 1 selects a sequence (of length 3 or larger) first, followed by Player 2. The player whose sequence comes up first wins. The question is, can player 2 maximise her chance?
Apparently, Player 2 can always select a sequence based on what Player 1 has already picked that can maximise her winning odds. It is based on a simple strategy. The second player looks at Player 1’s sequence and picks the opposite of the middle one to start with, followed by the first player’s first two choices.
Player1: 1-2-3
Player2: opp(2)-1-2
Here are a few examples from coin-tossing
Player 1 | Player 2 |
HHH | THH |
HTH | HHT |
TTH | HTT |
THT | TTH |
TTT | HTT |
Here is the R code to play and verify the odds.
itr <- 10000
sel <- c("H", "H", "H")
Ann <- paste(sel[1], sel[2], sel[3])
if(sel[2] == "H"){
sel[3] <- "T"
}else {
sel[3] <- "H"
}
Beck <- paste(sel[3], sel[1], sel[2])
penny <- replicate(itr, {
toss <- sample(c("H", "T"), 500, replace = TRUE, prob = c(1/2,1/2))
toss1 <- paste(toss,collapse=" ")
count_Ann <- str_locate(toss1, Ann)
count_Beck <- str_locate(toss1, Beck)
if (count_Ann[1,1] < count_Beck[1,1]) {
counter <- 0
} else {
counter <- 1
}
})
mean(penny)