<p>Helllo Everyone! OP here - thought of an answer to my own question!</p>
<p>Recently, I thought of the following &quot;game&quot; to illustrate &quot;mixed strategies and comparative advantages&quot;:</p>
<ul>
<li>There are two Players: Player 1 and Player 2</li>
<li>There are two Coins: Coin 1 and Coin 2</li>
<li>Coin 1 lands on &quot;Heads&quot; with a probability of 0.5 and &quot;Tails&quot; with a probability of 0.5</li>
<li>Coin 2 lands on &quot;Heads&quot; with a probability of 0.7 and &quot;Tails&quot; with a probability of 0.3</li>
<li>If Coin 1 is &quot;Heads&quot;, a score of -1 is obtained; if Coin 1 is &quot;Tails&quot;, a score of +1 is obtained</li>
<li>If Coin 2 is &quot;Heads&quot;, a score of -3 is obtained; if Coin 1 is &quot;Tails&quot;, a score of +4 is obtained</li>
</ul>
<p>In this game, Player 1 always starts first - Player 1 chooses either Coin 1 or Coin 2, flips the coin that they select and gets a &quot;score&quot;. Then, Player 2 chooses either Coin 1 or Coin 2, flips the coin that they select and get a &quot;score&quot;. The Player with the higher score wins, the Player with the lower score loses (a &quot;tie&quot; is also possible).</p>
<p>I wrote the R code to simulate this game being played 100 times:</p>
<pre><code>score_coin_1 = c(-1,1)

score_coin_2 = c(-3, 4)


results &lt;- list()

for (i in 1:100)

{

iteration = i


player_1_coin_choice_i = sample(2, 1, replace = TRUE)
player_2_coin_choice_i = sample(2, 1, replace = TRUE)

player_1_result_i = ifelse(player_1_coin_choice_i == 1, sample(score_coin_1, size=1, prob=c(.5,.5)),  sample(score_coin_2, size=1, prob=c(.7,.3)) )
player_2_result_i = ifelse(player_2_coin_choice_i == 1, sample(score_coin_1, size=1, prob=c(.5,.5)), sample(score_coin_2, size=1, prob=c(.7,.3)))

winner_i = ifelse(player_1_result_i &gt; player_2_result_i, &quot;PLAYER_1&quot;, ifelse(player_1_result_i == player_2_result_i, &quot;TIE&quot;, &quot;PLAYER_2&quot;))

my_data_i = data.frame(iteration, player_1_coin_choice_i, player_2_coin_choice_i, player_1_result_i, player_2_result_i , winner_i )

 results[[i]] &lt;- my_data_i

}



results_df &lt;- data.frame(do.call(rbind.data.frame, results))

head(results_df)
  iteration player_1_coin_choice_i player_2_coin_choice_i player_1_result_i player_2_result_i winner_i
1         1                      1                      1                -1                 1 PLAYER_2
2         2                      1                      2                -1                -3 PLAYER_1
3         3                      2                      2                 4                -3 PLAYER_1
4         4                      1                      2                 1                -3 PLAYER_1
5         5                      2                      1                 4                 1 PLAYER_1
6         6                      2                      2                 4                -3 PLAYER_1
</code></pre>
<p>Then, I analyzed the results (e.g. &quot;one_two_sum&quot; = player 1 chose coin 1 and player 2 chose coin 2):</p>
<pre><code> library(dplyr)
    
    one_one_sum = data.frame(one_one %&gt;% 
      group_by(winner_i) %&gt;% 
      summarise(n = n()))
    
    one_two_sum = data.frame(one_two %&gt;% 
      group_by(winner_i) %&gt;% 
      summarise(n = n()))
    
    two_one_sum = data.frame(two_one %&gt;% 
      group_by(winner_i) %&gt;% 
      summarise(n = n()))
    
    two_two_sum = data.frame(two_two %&gt;% 
      group_by(winner_i) %&gt;% 
      summarise(n = n()))
</code></pre>
<p>For instance, suppose Player 1 chose &quot;Coin 1&quot;:</p>
<pre><code>one_one_sum
  winner_i  n
1 PLAYER_1  9
2 PLAYER_2 10
3      TIE  9

 one_two_sum
  winner_i  n
1 PLAYER_1 23
2 PLAYER_2  6
</code></pre>
<p>Based on these results, it appears that if Player 1 picks &quot;Coin 1&quot;, Player 2 should also pick &quot;Coin 1&quot;, seeing that he has a 10/29 chance of winning and a 9/29 chance of &quot;tie&quot; (overall, a 19/29 chance of not losing).</p>
<p>Similarly, we can look at the optimal strategy if Player 1 picks &quot;Coin 2&quot;:</p>
<pre><code>two_one_sum
  winner_i  n
1 PLAYER_1  5
2 PLAYER_2 14

 two_two_sum
  winner_i  n
1 PLAYER_1  5
2 PLAYER_2  1
3      TIE 18
</code></pre>
<p>Based on these results, it appears that Player 2 should almost always pick Coin 1 if Player 2 picks Coin 2 - as Player 2 has a 14/19 chance of winning if this happens.</p>
<p>The overall results can be summarized in a table like this:</p>
<p><a href="https://i.sstatic.net/AdfHd.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/AdfHd.png" alt="enter image description here" /></a></p>
<p>I would be curious to see how complicated this game gets when more coins are involved and players have more turns!</p>
<p>Thanks everyone!</p>

CC BY-SA 4.0
2022-03-03T07:32:39.650Z
2022-03-03T07:32:39.650Z
stats_noob
<p>I am trying to create a simple Game Theory game in which :</p>
<ul>
<li>Two players are competing against each other (Player 1 and Player 2)</li>
<li>Each player can either perform &quot;Action A&quot; or &quot;Action B&quot;</li>
<li>There is some element of probability</li>
</ul>
<p>The whole point of this, is to show that in this game - <strong>there are some instances in which it is clearly more favorable to perform &quot;Action A&quot; and some instances in which it is clearly more favorable to perform &quot;Action B&quot;</strong></p>
<p>I tried to imagine the following situation:</p>
<ul>
<li>Player 1 always starts the game</li>
<li>Players take turns rolling a 6 sided die (singular of &quot;dice&quot;). Player 1 rolls, Player 2 rolls, Player 1 rolls, Player 2 rolls, etc.</li>
<li>For example, Player 1 first turn = 4, Player 1 second turn = 6, Player 1 third turn = 5 : <strong>Player 1 Current Score = 4 + 6 + 5 = 15</strong></li>
<li>The first roll for Player 1 is kept hidden from Player 2 and the first roll of Player 2 is kept hidden from Player 1</li>
<li>A player wins the game when the sum of all rolls that he has made is exactly &quot;25&quot;</li>
<li>A player looses if his sum is more than &quot;25&quot;.</li>
<li>If both players have exactly &quot;25&quot;, they &quot;tie&quot;, and if both players go over &quot;25&quot; they both tie.</li>
<li>At any time, a player can decide to &quot;hold&quot; - for instance, the sum of all previous rolls for Player 1 might be &quot;22&quot;. Player 1 might decide it's too risky to continue playing for a perfect score of &quot;25&quot; and decides to &quot;hold&quot; and can not roll anymore - in this case Player 2 gets to keep rolling until Player 2 decides to &quot;hold&quot;</li>
<li>When both players are done, they reveal their first roll to each other : the player with the closest sum to 25 wins and any player with a sum over 25 automatically loses.</li>
<li>Players have the ability to &quot;bluff&quot; - for instance, a player might have rolled over 25, but he can keep rolling and give the other player the impression that his first roll was a low number (e.g. &quot;1&quot;), and is still not eliminated and trying to get close to 25. This might &quot;trick&quot; the other player to incurring extra risk by continuing to roll and end up losing.</li>
</ul>
<p>In the above game, <strong>&quot;Action A&quot;</strong> could be to &quot;keep rolling&quot; and <strong>&quot;Action B&quot;</strong> could be to &quot;hold&quot;.</p>
<p>I would like to analyze this game using Game Theory - for instance:</p>
<ul>
<li>Suppose I write a computer simulation in which this game is randomly played 1000 times</li>
<li>For the sake of the simulation, let's assume that a player can choose to &quot;continue&quot; with probability 0.5 and &quot;hold&quot; with probability 0.5 .</li>
</ul>
<p><strong>My Question:</strong> When we analyze the results and outcomes of these 1000 random simulations, would it be possible to make a &quot;chart&quot; that shows for Player 1 at any given time:</p>
<ul>
<li>Based on the number of rolls made by Player 2 (e.g. Player 2 has rolled the dice 3 times)</li>
<li>Based on the current sum of Player 2 excluding his first hidden roll (e.g. Player 2 has a  sum of 14)</li>
<li>Based on the number of rolls made by Player 1</li>
<li>Based on the current of Player including his first hidden roll</li>
</ul>
<p><strong>Whether Player 1 should keep playing or whether he should stop playing?</strong></p>
<p>This would mean that any point in the game, before Player 1 makes a decision, he can know:</p>
<ul>
<li>What is the probability of &quot;winning&quot;, &quot;losing&quot;, &quot;tie&quot; if he decides to continue playing?</li>
<li>What is the probability of &quot;winning&quot;, &quot;losing&quot;, &quot;tie&quot; if he decides to stop playing?</li>
</ul>
<p>As I type this out, I realize this is a far more complicated than I had originally anticipated - <strong>can someone think of a much &quot;simpler&quot; game in which a chart can be made at different points in time (e.g. each turn), showing the probability of winning/losing for choosing some &quot;Action A&quot; or &quot;Action B&quot;?</strong></p>
<p>Thanks!</p>

CC BY-SA 4.0
2022-03-03T06:42:21.057Z
Very complex indeed. If you find an answer, it might be worth writing a research paper about it. The problem reminds me of Kuhn poker: https://en.wikipedia.org/wiki/Kuhn_poker. That's a simple stage game with some incentives to bluff. Still, it's a one-shot game, while you envision the game being repeated multiple times. How do you think the players will handle history? And, are the payoffs discounted in any way?
Thomas Favory
CC BY-SA 4.0
2022-03-03T07:34:03.960Z
@ Thomas: Thank you for your reply! I am an amateur and could not even dream of writing a paper LOL ! I will check out this link on Kuhn Poker .... I thought of an example to solve my problem, I posted an answer below - check it out!
stats_noob
CC BY-SA 4.0
2022-03-03T07:35:59.700Z
Is this the same thing as Kuhn Poker? https://www.youtube.com/watch?v=N68s_UgOFBc
stats_noob
CC BY-SA 4.0
2022-03-04T10:10:15.413Z
That is not exactly the same game. But the one in the video is much simpler.

Anyway, I need to figure out why you want to run these simulations in the first place. Which statement corresponds the most to what you have in mind: 
1) Players are friends who played the same game 1000 times. 
2) There are 1000 couples who play that game only once?
Thomas Favory
CC BY-SA 4.0
2022-03-04T16:09:26.337Z
Thank you for your reply! Suppose there is Player A and Player B - they are competing against each other and play this game 1000 times (without knowing the probabilities of each coin landing on heads or tails). Now, Player C and Player D get access to the results of these 1000 games (and they also do not know the probabilities of each coin landing on heads or tails) - based on the results from Player A and Player B, they try to figure out which coin should they flip to increase their chances of winning - given information about what result was obtained by the first player.
stats_noob
CC BY-SA 4.0
2022-03-04T16:10:25.877Z
However, the way I have designed the game - it always seems to me that the second Player always has an advantage.
stats_noob
<game-theory>
Creating a Game Theory "Game"
stats_noob
# Creating a Game Theory "Game"

(Asked by: username_0 on 2022-02-28)

I am trying to create a simple Game Theory game in which :

* Two players are competing against each other (Player 1 and Player 2)
* Each player can either perform "Action A" or "Action B"
* There is some element of probability

The whole point of this, is to show that in this game - **there are some instances in which it is clearly more favorable to perform "Action A" and some instances in which it is clearly more favorable to perform "Action B"**

I tried to imagine the following situation:

* Player 1 always starts the game
* Players take turns rolling a 6 sided die (singular of "dice"). Player 1 rolls, Player 2 rolls, Player 1 rolls, Player 2 rolls, etc.
* For example, Player 1 first turn = 4, Player 1 second turn = 6, Player 1 third turn = 5 : **Player 1 Current Score = 4 + 6 + 5 = 15**
* The first roll for Player 1 is kept hidden from Player 2 and the first roll of Player 2 is kept hidden from Player 1
* A player wins the game when the sum of all rolls that he has made is exactly "25"
* A player looses if his sum is more than "25".
* If both players have exactly "25", they "tie", and if both players go over "25" they both tie.
* At any time, a player can decide to "hold" - for instance, the sum of all previous rolls for Player 1 might be "22". Player 1 might decide it's too risky to continue playing for a perfect score of "25" and decides to "hold" and can not roll anymore - in this case Player 2 gets to keep rolling until Player 2 decides to "hold"
* When both players are done, they reveal their first roll to each other : the player with the closest sum to 25 wins and any player with a sum over 25 automatically loses.
* Players have the ability to "bluff" - for instance, a player might have rolled over 25, but he can keep rolling and give the other player the impression that his first roll was a low number (e.g. "1"), and is still not eliminated and trying to get close to 25. This might "trick" the other player to incurring extra risk by continuing to roll and end up losing.

In the above game, **"Action A"** could be to "keep rolling" and **"Action B"** could be to "hold".

I would like to analyze this game using Game Theory - for instance:

* Suppose I write a computer simulation in which this game is randomly played 1000 times
* For the sake of the simulation, let's assume that a player can choose to "continue" with probability 0.5 and "hold" with probability 0.5 .

**My Question:** When we analyze the results and outcomes of these 1000 random simulations, would it be possible to make a "chart" that shows for Player 1 at any given time:

* Based on the number of rolls made by Player 2 (e.g. Player 2 has rolled the dice 3 times)
* Based on the current sum of Player 2 excluding his first hidden roll (e.g. Player 2 has a sum of 14)
* Based on the number of rolls made by Player 1
* Based on the current of Player including his first hidden roll

**Whether Player 1 should keep playing or whether he should stop playing?**

This would mean that any point in the game, before Player 1 makes a decision, he can know:

* What is the probability of "winning", "losing", "tie" if he decides to continue playing?
* What is the probability of "winning", "losing", "tie" if he decides to stop playing?

As I type this out, I realize this is a far more complicated than I had originally anticipated - **can someone think of a much "simpler" game in which a chart can be made at different points in time (e.g. each turn), showing the probability of winning/losing for choosing some "Action A" or "Action B"?**

Thanks!

**Tags:** game-theory

> **Comments:**
> **username_1**: Very complex indeed. If you find an answer, it might be worth writing a research paper about it. The problem reminds me of Kuhn poker: https://en.wikipedia.org/wiki/Kuhn_poker. That's a simple stage game with some incentives to bluff. Still, it's a one-shot game, while you envision the game being repeated multiple times. How do you think the players will handle history? And, are the payoffs discounted in any way?  
> **username_0**: @ Thomas: Thank you for your reply! I am an amateur and could not even dream of writing a paper LOL ! I will check out this link on Kuhn Poker .... I thought of an example to solve my problem, I posted an answer below - check it out!  
> **username_0**: Is this the same thing as Kuhn Poker? https://www.youtube.com/watch?v=N68s_UgOFBc  
> **username_1**: That is not exactly the same game. But the one in the video is much simpler.  Anyway, I need to figure out why you want to run these simulations in the first place. Which statement corresponds the most to what you have in mind:  1) Players are friends who played the same game 1000 times.  2) There are 1000 couples who play that game only once?  
> **username_0**: Thank you for your reply! Suppose there is Player A and Player B - they are competing against each other and play this game 1000 times (without knowing the probabilities of each coin landing on heads or tails). Now, Player C and Player D get access to the results of these 1000 games (and they also do not know the probabilities of each coin landing on heads or tails) - based on the results from Player A and Player B, they try to figure out which coin should they flip to increase their chances of winning - given information about what result was obtained by the first player.  
> **username_0**: However, the way I have designed the game - it always seems to me that the second Player always has an advantage.  

---

## 1 answers

### Answer by username_0 on 2022-03-03. Score: 1

Helllo Everyone! OP here - thought of an answer to my own question!
Recently, I thought of the following "game" to illustrate "mixed strategies and comparative advantages":

There are two Players: Player 1 and Player 2
There are two Coins: Coin 1 and Coin 2
Coin 1 lands on "Heads" with a probability of 0.5 and "Tails" with a probability of 0.5
Coin 2 lands on "Heads" with a probability of 0.7 and "Tails" with a probability of 0.3
If Coin 1 is "Heads", a score of -1 is obtained; if Coin 1 is "Tails", a score of +1 is obtained
If Coin 2 is "Heads", a score of -3 is obtained; if Coin 1 is "Tails", a score of +4 is obtained

In this game, Player 1 always starts first - Player 1 chooses either Coin 1 or Coin 2, flips the coin that they select and gets a "score". Then, Player 2 chooses either Coin 1 or Coin 2, flips the coin that they select and get a "score". The Player with the higher score wins, the Player with the lower score loses (a "tie" is also possible).
I wrote the R code to simulate this game being played 100 times:
score_coin_1 = c(-1,1)

score_coin_2 = c(-3, 4)


results <- list()

for (i in 1:100)

{

iteration = i


player_1_coin_choice_i = sample(2, 1, replace = TRUE)
player_2_coin_choice_i = sample(2, 1, replace = TRUE)

player_1_result_i = ifelse(player_1_coin_choice_i == 1, sample(score_coin_1, size=1, prob=c(.5,.5)),  sample(score_coin_2, size=1, prob=c(.7,.3)) )
player_2_result_i = ifelse(player_2_coin_choice_i == 1, sample(score_coin_1, size=1, prob=c(.5,.5)), sample(score_coin_2, size=1, prob=c(.7,.3)))

winner_i = ifelse(player_1_result_i > player_2_result_i, "PLAYER_1", ifelse(player_1_result_i == player_2_result_i, "TIE", "PLAYER_2"))

my_data_i = data.frame(iteration, player_1_coin_choice_i, player_2_coin_choice_i, player_1_result_i, player_2_result_i , winner_i )

 results[[i]] <- my_data_i

}



results_df <- data.frame(do.call(rbind.data.frame, results))

head(results_df)
  iteration player_1_coin_choice_i player_2_coin_choice_i player_1_result_i player_2_result_i winner_i
1         1                      1                      1                -1                 1 PLAYER_2
2         2                      1                      2                -1                -3 PLAYER_1
3         3                      2                      2                 4                -3 PLAYER_1
4         4                      1                      2                 1                -3 PLAYER_1
5         5                      2                      1                 4                 1 PLAYER_1
6         6                      2                      2                 4                -3 PLAYER_1

Then, I analyzed the results (e.g. "one_two_sum" = player 1 chose coin 1 and player 2 chose coin 2):
 library(dplyr)
    
    one_one_sum = data.frame(one_one %>% 
      group_by(winner_i) %>% 
      summarise(n = n()))
    
    one_two_sum = data.frame(one_two %>% 
      group_by(winner_i) %>% 
      summarise(n = n()))
    
    two_one_sum = data.frame(two_one %>% 
      group_by(winner_i) %>% 
      summarise(n = n()))
    
    two_two_sum = data.frame(two_two %>% 
      group_by(winner_i) %>% 
      summarise(n = n()))

For instance, suppose Player 1 chose "Coin 1":
one_one_sum
  winner_i  n
1 PLAYER_1  9
2 PLAYER_2 10
3      TIE  9

 one_two_sum
  winner_i  n
1 PLAYER_1 23
2 PLAYER_2  6

Based on these results, it appears that if Player 1 picks "Coin 1", Player 2 should also pick "Coin 1", seeing that he has a 10/29 chance of winning and a 9/29 chance of "tie" (overall, a 19/29 chance of not losing).
Similarly, we can look at the optimal strategy if Player 1 picks "Coin 2":
two_one_sum
  winner_i  n
1 PLAYER_1  5
2 PLAYER_2 14

 two_two_sum
  winner_i  n
1 PLAYER_1  5
2 PLAYER_2  1
3      TIE 18

Based on these results, it appears that Player 2 should almost always pick Coin 1 if Player 2 picks Coin 2 - as Player 2 has a 14/19 chance of winning if this happens.
The overall results can be summarized in a table like this:

I would be curious to see how complicated this game gets when more coins are involved and players have more turns!
Thanks everyone!


---

