
Daily Series #2: Geeking out β Monte Carlo Simulations
I will continue with this series for people who like this kind of content, drop "+1" in the chat and I will tag you the next time I post content.
Imagine you have a very complex situation with varying degrees of randomness. How do you evaluate the probability of certain outcomes?
One way is a deterministic way which is to sit down and try to compute probabilities of events. Another way is to simulate these interactions with various seed values and see how these outcomes vary. This is called a Monte Carlo simulation, where we use random sampling to model and analyze complex systems that involve uncertainty.
Let's set up a game and apply a Monte Carlo simulation to it.
You(Hero) and Me(Villain) engage in a strategic coin flipping competition over a series of rounds. Before each round, both of us independently decide whether to flip a coin or pass the turn to the opponent.
The outcomes are as follows:
- If both players decide to flip, a fair coin is tossed, and the player who called it correctly gains a point.
- If one player decides to flip and the other passes, the flipping player gains a point without the need for a coin toss.
- If both players pass, no points are gained or lost.
We can simulate it by making each decision random:
- Hero and Villain both independently choose between 0 and 1 for deciding whether to toss or pass. We use 0 as Pass and 1 as Toss.
- If both pass then we let the scores as is.
- If one passes and not the other, then we add +1 to whoever decided to toss.
- If both decide to toss then, we do a random coin flip where 0 = Heads and 1 = Tails. Hero can randomly choose between Heads or Tails. The Villain takes the opposite position.
First is the Monte Carlo Simulation and the difference between potential outcomes for 1000 rounds and 20 simulations, which is the graph shared.

One interview, 1000+ job opportunities
Take a 10-min AI interview to qualify for numerous real jobs auto-matched to your profile π
We can also simulate, : both_flip: 0.36 average score difference you_flip_I_pass: -0.28 average score difference you_pass_I_flip: 0.32 average score difference both_pass: 0.00 average score difference
Optimal Strategy: both_flip with an average score difference of 0.36. Why?

@salt amazing work salt! π
Please keep doing this, and kindly cover topics like Particle filers, Kalman filters, Decision trees, Random forests, etc

+1 Also, can you share link to your previous post?
Man, looks like I am stupidπ although I understood the simulation(thanks to @salt your efforts to make it eli5), I didn't understand the outcome or the reasoning.
- As far as I understand, monte Carlo way was 1 of the 20 simulations and it performed the best for 1000 runs done across all simulations. Best is said where the difference between the player 1 and 2 is the max? Am I getting this right? Further questions -
- The simulation picks up random numbers for when player 1 wins or not, right? So it's entirely random, which means it can very well generate a different result?
- How did you arrive at values that you shared in one of the comments and what does the value signify?
- Where can I learn more about all this so that I am bit well versed with this kind of maths?

-
All of them are Monte Carlo simulations. Ideally yes, but it any outcome is pure chance. So, best is said where we track all strategies and then simulate many many times and take the average difference.
-
Yes.
-
Answered in 1.
-
You should read up a little on Game Theory and just Monte Carlo simulations online.

Next post: https://share.gvine.app/8m3D1hP3sDfc6usY6

This is so cool and thank you so much for tagging me! I have no idea if it's my health or my exhausted brain, but I have no idea what to do here! π

+1

@Viking Added to the Tag list. Welcome hahaha.

Hey! Thanks!

+1

@tbk I already added you champ.

This is a standard game theory example. Veritasium has a video on it to explain better. Here is the link : https://youtu.be/mScpHTIi-kM?si=rFgKCRpDB986l_I5
Strategies where both parties agree are winner strategies. Any strategy where you try to cause a loss to the other side, don't win eventually when the count of games is high.

True very true. But it also heavily depends on the odds and that is why Globally optimal solutions are unstable nash equilibrium.

Watch the Veritasium video, they do simulate all different starting conditions & behaviours. Eventually agreeable outcomes come out as winners


