SquishyQuokka
SquishyQuokka

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:

  1. If both players decide to flip, a fair coin is tossed, and the player who called it correctly gains a point.
  2. If one player decides to flip and the other passes, the flipping player gains a point without the need for a coin toss.
  3. If both players pass, no points are gained or lost.

We can simulate it by making each decision random:

  1. 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.
  2. If both pass then we let the scores as is.
  3. If one passes and not the other, then we add +1 to whoever decided to toss.
  4. 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.

Post image
14mo ago
Talking product sense with Ridhi
9 min AI interview5 questions
Round 1 by Grapevine
SquishyQuokka
SquishyQuokka
Gojek14mo

Tags: @Sherlock007 @BladeRunner007 @TheOatmeal

SquishyQuokka
SquishyQuokka
Gojek14mo

@JadeArgent @potatomato @BiryaniEnthu

SquishyQuokka
SquishyQuokka
Gojek14mo

@Elon_Musk @ElonMast @Rhombus

SquishyQuokka
SquishyQuokka
Gojek14mo

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?

SquishyQuokka
SquishyQuokka
Gojek14mo

Looking to your answer.

SillyPenguin
SillyPenguin

This would reduce with more number of simulations. 20 is too less. Also can you share how have you calculated average score difference. This does not look like the correct metric to measure.

FloatingMuffin
FloatingMuffin
Google13mo

@salt amazing work salt! πŸ‘

Please keep doing this, and kindly cover topics like Particle filers, Kalman filters, Decision trees, Random forests, etc

FloatingMuffin
FloatingMuffin
Google13mo

Also Dynamic programming , Genetic algorithm

SquishyQuokka
SquishyQuokka
Gojek13mo

I would actually love to. It is super duper interesting to learn about these topics.

DizzyLlama
DizzyLlama
Atlys13mo

+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.

  1. 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 -
  2. 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?
  3. How did you arrive at values that you shared in one of the comments and what does the value signify?
  4. Where can I learn more about all this so that I am bit well versed with this kind of maths?
SquishyQuokka
SquishyQuokka
Gojek13mo
  1. 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.

  2. Yes.

  3. Answered in 1.

  4. You should read up a little on Game Theory and just Monte Carlo simulations online.

SquishyQuokka
SquishyQuokka
Gojek13mo
ZestyDonut
ZestyDonut

+1

SquishyQuokka
SquishyQuokka
Gojek14mo

@TheOatmeal Added to the Tag list. Welcome hahaha.

ZestyDonut
ZestyDonut

Can’t miss your posts

DerpyPancake
DerpyPancake

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! πŸ˜„

SquishyQuokka
SquishyQuokka
Gojek13mo

@JadeArgent I will always remember you. You mean a lot to me. 🀞🏻

DerpyPancake
DerpyPancake

@salt ao incredibly kind of you! Did I play a significant role in the accumulation of your grapes? :3

SparklyRaccoon
SparklyRaccoon

+1

SquishyQuokka
SquishyQuokka
Gojek14mo

@steppenwolf

SquishyQuokka
SquishyQuokka
Gojek14mo

Added to the Tag list. Welcome hahaha.

DancingPenguin
DancingPenguin

+1

SquishyQuokka
SquishyQuokka
Gojek14mo

@Viking Added to the Tag list. Welcome hahaha.

DancingPenguin
DancingPenguin

Hey! Thanks!

CosmicQuokka
CosmicQuokka

+1

SquishyQuokka
SquishyQuokka
Gojek14mo

@tbk I already added you champ.

FloatingBiscuit
FloatingBiscuit

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.

SquishyQuokka
SquishyQuokka
Gojek13mo

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

FloatingBiscuit
FloatingBiscuit

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

Discover more
Curated from across
Misc
Misc22mo
by WobblyCoconutProduct Manager

How do I learn pro-level poker?

What are some things that I could do if I want to learn the art and eventually participate in professional level poker?

I have played a lot with friends but I really want to go deeper into it.

Mumbai
Mumbai12mo
by FloatingWalrusLawyer

Made Rs. 8000 using Machine Learning models in 1 day...

Here's how I modelled my data:

  1. Got statistics of the entire Pak and Ind squads with their last 5 performances.
  2. Got statistics of Last 3 games at Nassau County Stadium.
  3. Got betting odds for all of these matches.

Used a very...

Post image
Top comments
user

I asked ChatGPT what this means: Firstly, this individual gathered a lot of data, including statistics about the pla...

user

Hahaha Stay from betting with ML , this will end up very badly.