img

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.

img
img

salt

Gojek

5 months ago

img

salt

Gojek

5 months ago

img

ThirdBansal

Flipkart

5 months ago

See more comments
img

salt

Gojek

5 months ago

img

salt

Gojek

5 months ago

img

salt

Gojek

5 months ago

See more comments
img

ElonMast

Amazon

5 months ago

img

salt

Gojek

5 months ago

img

President_Trump

Stealth

5 months ago

See more comments
img

3xPlusOne

Google

5 months ago

img

3xPlusOne

Google

5 months ago

img

salt

Gojek

5 months ago

See more comments
img

TheOatmeal

Stealth

5 months ago

img

salt

Gojek

5 months ago

img

TheOatmeal

Stealth

5 months ago

img

jake_peralta_B99

Unemployed

5 months ago

img

salt

Gojek

5 months ago

img

salt

Gojek

5 months ago

See more comments
img

tbk

Startup

5 months ago

img

salt

Gojek

5 months ago

img

FreshDew5

Oracle

5 months ago

img

salt

Gojek

5 months ago

img

FreshDew5

Oracle

5 months ago

img

Viking

Acuity Knowledge

5 months ago

img

salt

Gojek

5 months ago

img

Viking

Acuity Knowledge

5 months ago

img

JadeArgent

Independent Law Practice

5 months ago

img

salt

Gojek

5 months ago

img

JadeArgent

Independent Law Practice

5 months ago

img

DennisRitchie

BNY Mellon

5 months ago

img

salt

Gojek

5 months ago

img

steppenwolf

Stealth

5 months ago

img

salt

Gojek

5 months ago

img

salt

Gojek

5 months ago

img

Ctrl_alt_dlt

Porter

5 months ago

img

salt

Gojek

5 months ago

img

Toph56

Stealth

5 months ago

img

salt

Gojek

5 months ago

img

GyobuMasatakaOniwa

Swiggy

5 months ago

img

salt

Gojek

5 months ago

img

ExoticCold

Quicko

5 months ago

img

salt

Gojek

5 months ago

img

Napolean_bonafide

Amazon

5 months ago

img

salt

Gojek

5 months ago

img

DerangedPundit

Google

5 months ago

img

salt

Gojek

5 months ago

img

cannotknot

Startup

5 months ago

img

salt

Gojek

5 months ago

img

Rimnam

Razorpay

5 months ago

img

salt

Gojek

5 months ago

Sign in to a Grapevine account for the full experience.

Discover More

Curated from across

img

Misc on

by ElonMast

Amazon

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 (or at least heard in class πŸ€ͺ). Below we have a picture of a very basic Resistor-Capacitor (RC) circuit connected to a battery (Voltage). For theoretical simplifications, we assumed the resistor to have a single, whole-number value (for example, a 5-ohm resistance). In real when we manufacture such resistance (or capacitors), due to complexities associated with manufacturing processes, exhibit a tolerance range around the base value. The resistor we took might exhibit a value between 4.95 ohm to 5.05 ohm. Such range variations lead to changes in currents flowing through these circuits. Now imagine, a simple home device having millions of such resistors. All these devices would exhibit different resistance values (some might show 4.95, others might show 5.025, rest 5.05). All these variations make the life of an electronics designer much more complicated. They use Monte-Carlo simulations to explore the range of output current variations and define downstream parameters accordingly. MC makes life bit deterministic in an otherwise uncertain electronics world! I hope, I am able to add some value to β€œgeeking-out” series. Shoot your queries, if anyπŸ€“ (Image - spice simulation tutorial from Google)

img
img

Data Scientists on

by salt

Gojek

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 of the first three face-up cards to the board" Now, let's look at the table and their positions: 1. Blinds: First to act every street after pre-flop. 2. Early positions: Under the Gun(UTG) 3. Middle positions 4. Late positions: Button and Cut Off The order for a 10 person game would be: Small Blind(SB) β†’ Big Blind(BB) β†’ Under the Gun(UTG) β†’ UTG+1 β†’ UTG+2 β†’ MP1 β†’ MP2 β†’ MP3 β†’ Cutting off the Button (CO) β†’ Button (BTN) and then order repeats ... Some insights: 1. Blinds see the flop at a discount because they are compelled to play but are at a disadvantage because they are first to act. 2. This means that more money is made in late positions because they have more information to act on. 3. However in short stack situations, where effective stack size is small then early positions are better because you have the opportunity to go all in before someone else can as you can maintain Fold equity(Equity from Aggression). So, Expected Value or E(V) is how do you determine whether you should call or fold basis the size of the pot and your contribution to it basis the number of outs(potential winning hands) you have. E(V) = Win % * Win Amt - Lose % * Lose Amt For example: Villain(V) [UTG+1] = $500 Hero(H) (MP1) = $500 SB/BB + Ante = 20/40 + 10 Here, Ante is the bet everyone has to make every hand. This is to make the pot worth playing for everyone. Pre-Flop: $140 H = A 10 (suited Hearts) V = ? (Unknown) 1 Fold V raises $120 H calls $120, 5 Folds Flop: $380 The flop is 8 Heart, 3 Heart, K Club V = $370 (All In) H = ? (Do you call or fold?) Solution: A call is positive E(V) if: Win % > Call Amt/ Pot after Call You have a strong hand if you can get a flush here. which means you need one of the next two cards Heart Heart Club | Heart* | Heart* Which means: Win % = 1 - (Odds of 2 cards not being Hearts) = 1 - (40/49 * 39/48) = ~ 36% So, 370/1120 = ~33% is Call Amt/Pot after Call Since, 36% > 33% Hero should call. E(V) = 36% * (380+x) - x * 66% E(V) cut off at 0, x = $404 You stand to make $ if you decide to call that bet. You can raise any amount till $404 for a positive E(V) after which you should mathematically fold. An easier way to calculate this is to use 2% if you can only see one card after flop and 4% if you can see both cards. That way, Win % here would be = 4% * 9 = 36% 9 outs because, 9 cards that are Hearts are left in the deck.

img

Software Engineers on

by salt

Gojek

Daily Series #3: Geeking out β†’ The Labyrinth Problem

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. Today, I was in the mood to go through some old CS problems I had solved a few years back. The problem is described in cses.fi [ https://cses.fi/problemset/task/1193 ] and is as follows: You are given a map of a labyrinth, and your task is to find a path from start to end. You can walk left, right, up and down. π—œπ—»π—½π˜‚π˜π˜€: You are given n and m: the height and width of the map. Then there are n lines of m characters describing the labyrinth. Each character is . (floor), # (wall), A (start), or B (end). There is exactly one A and one B in the input. π—’π˜‚π˜π—½π˜‚π˜: Revert with "YES" if a path is possible. Revert with "NO" if no path is possible. If "YES" also mention the path taken to reach B from A as L(left), R (right), U (up), and D (down). How do you solve a problem like this? Solution Approach: You traverse through the input and figure out where A and B lie within the input as (i,j) coordinates. Then, we do something called flood fill approach, where we start at A and then we update moves with BFS until we reach B. (L/D/R/U) Now, what we need to check next is whether it violates some assumptions. 1. Check each adjacent cell and it is not supposed to be a wall(#) 2. Adjacent cell should not be out of bounds, for example cells on the boundary cannot go outside the labyrinth. 3. Lastly we need to track that we have not already visited that cell before. If none of these cases are violated then we proceed to move in that direction. Then we apply BFS again and check for violation of these cases. All the while we maintain whether we visited that cell before and the path we have taken from A. We stop when we reach B's location. Now what happens if we don't reach B? Since, we are applying BFS we will end up reaching all cells except B. We would have completed entire traversal of the labyrinth yet no B in sight.

img
img

Office Gossip on

by altGrape

Stealth

Daily Masala: Edition #2

Let me spill the tea on what's buzzing over at Grapevine in last 24 hours. You're in for a treat with these top posts, so let's dive in ASAP: 1. ServiceNow Interview Disaster - https://share.gvine.app/yPfdLxoKeMojQ6tF6 Honey, let me spill the tea. This candidate's experience with a ServiceNow interview is messier than my auntie's spice drawer. A fresher interviewing a senior? That's like a toddler teaching a chef how to cook biryani. ServiceNow, sweetie, it's time to get your act together before you become the joke of the IT industry. 2. Poker Math for the Geeks - https://share.gvine.app/puCYn1PLfHPspDKh9 Oh, lordy, poker and math combined? This is giving very much "I peaked in high school math club" vibes. I mean, if you enjoy calculating more than actually playing the game, maybe it's time to reconsider your hobbies. But who am I to judge? Maybe that's your idea of a wild Friday night. 3. A Call for Startup Ideas - https://share.gvine.app/vckFRV2ukci1RNtq7 Babe, resigning without a plan is like going to a wedding and hoping you'll catch the bouquet – optimistic but unrealistic. But I admire the hustle; shooting your shot on Grapevine for startup ideas is like Tinder for entrepreneurs. Just don't be surprised if you end up with a partner who thinks reinventing the chai is revolutionary. 4. Delhi Travel Precautions - https://share.gvine.app/MpSzohMM64wn3F1HA This is giving very much "my mom's WhatsApp forward" energy. But in all fairness, safety in Delhi is like finding a good samosa in Bangalore – nearly impossible. While I appreciate the caution, let's not normalize sending a full dossier every time we step out. Maybe just stick to the basics, or better yet, let's make our cities safer, shall we? 5. Sugarcane Juice > Alcohol Parties - https://share.gvine.app/9mtKHW8kBqt6Mpg5A Finally, someone said it! Why are we glorifying alcohol when we can party healthily? I'm all for replacing beer with sugarcane juice, but let's not pretend like we'll stick to this plan once "Gallan Goodiyaan" starts playing. Still, cheers to the idea – it's sweet, both literally and figuratively. 6. Rahul Gandhi's Employment Plan - https://share.gvine.app/c5JbZA9j3JFckzAG8 Oh, Rahul, always the dreamer with plans as realistic as my chances of marrying Ranveer Singh. Promising money for watching reels? That's not a job strategy; that's called being a Gen Z with too much time. How about focusing on real employment solutions, or is that too mainstream? 7. Max Salary for 20-Year IT Experience - https://share.gvine.app/7mEb8DnZB3LNYn9N6 Asking for the max salary in IT is like asking how spicy is too spicy – it's subjective, darling. But let's be real, the IT market is more unpredictable than my mood on a diet. So, aim high but maybe don't start planning your mansion just yet. 8. Arrogant IITs Not Getting Jobs - https://share.gvine.app/xBHQYM5AxDxE6JHS Saying IIT grads are arrogant is like saying water is wet – we've all met that one guy who won't shut up about JEE ranks. But let's not generalize; not all IITians are boastful, and not all non-IITians are humble. It's about skill, not the label on your degree. 9. The Beauty of Tech Projects - https://share.gvine.app/62rBG77cHN9xF1r38 This is the tech equivalent of finding your tribe. Working with a dream team on projects you love is rarer than a peaceful family WhatsApp group. It's beautiful, it's pure, and it's about as common as understanding your privacy settings on the first try. 10. The Indian FAANG Roadmap - https://share.gvine.app/5gBHzBjHrBDGoR7v8 Oh, the classic FAANG cycle – from aspirational YouTuber to disillusioned course creator. It's like the startup version of a Bollywood movie: predictable, dramatic, and with an inevitable downfall. But hey, if you can't join 'em, teach 'em (for a small fee, of course).' Oh, the drama on Grapevine never fails to entertain. Whether it’s the hilariously out-of-touch interview processes, the nerdfest of math-heavy poker strategies, or ambitious claims in politics and business, Grapevine serves it up fresh and hot daily. It’s the perfect blend of reality check and escapism. Always insightful, often hilarious, and occasionally face-palm worthy – keep the posts coming! What’s next, Grapevine? We're all ears!