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
11mo ago
Talking product sense with Ridhi
9 min AI interview5 questions
Round 1 by Grapevine
SquishyQuokka
SquishyQuokka
Gojek11mo

Tags: @Sherlock007 @BladeRunner007 @TheOatmeal

SquishyQuokka
SquishyQuokka
Gojek11mo

@JadeArgent @potatomato @BiryaniEnthu

SquishyQuokka
SquishyQuokka
Gojek11mo

@Elon_Musk @ElonMast @Rhombus

SquishyQuokka
SquishyQuokka
Gojek11mo

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
Gojek11mo

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.

FluffyCupcake
FluffyCupcake
Amazon11mo

Interesting, monte-carlo(MC) is commonly used in silicon circuits simulation to explore the boundaries of a design.
If we’re geeking on MC use cases, I can elaborate further.

SquishyQuokka
SquishyQuokka
Gojek11mo

@ElonMast Oh man. Please go on. I would love to learn more. I first learnt about MC simulations when I was reading this book called "A Random Walk Down Wall Street". I was still a kid and it blew my mind.

Go for it. Tell me more about silicon circuit simulation and wayyyyyy more.

PrancingNugget
PrancingNugget

@ElonMast heard about it somewhere. Please tell us more.

FloatingMuffin
FloatingMuffin
Google11mo

@salt amazing work salt! 👏

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

FloatingMuffin
FloatingMuffin
Google11mo

Also Dynamic programming , Genetic algorithm

SquishyQuokka
SquishyQuokka
Gojek11mo

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

DizzyLlama
DizzyLlama
Atlys11mo

+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
Gojek11mo
  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
Gojek11mo
ZestyDonut
ZestyDonut

+1

SquishyQuokka
SquishyQuokka
Gojek11mo

@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
Gojek11mo

@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
Gojek11mo

@steppenwolf

SquishyQuokka
SquishyQuokka
Gojek11mo

Added to the Tag list. Welcome hahaha.

DancingPenguin
DancingPenguin

+1

SquishyQuokka
SquishyQuokka
Gojek11mo

@Viking Added to the Tag list. Welcome hahaha.

DancingPenguin
DancingPenguin

Hey! Thanks!

CosmicQuokka
CosmicQuokka

+1

SquishyQuokka
SquishyQuokka
Gojek11mo

@tbk I already added you champ.

Discover more
Curated from across
Misc
Misc11mo
by FluffyCupcakeProduct Manager

Daily Series #3: Geeking out → Monte Carlo Simulations

Taking lead from @salt, extending the applications of Monte-Carlo(MC) to silicon circuits simulations.

I am trying to pick stuff from BTech, 1st year Basic Electronics which most engineers (irrespective of branch) would have studied (o...

Post image
Data Scientists
by SquishyQuokkaGojek

Daily Series #1: Geeking out → Poker Math

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.

I assume you guys know some basics of Texas Hold'em Poker. Flop refers to "the dealing o...

Misc
Misc19mo
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.