Skip to content

Instantly share code, notes, and snippets.

View Heril's full-sized avatar

Spencer R Hall Heril

View GitHub Profile
@Heril
Heril / gist:03d629e64557b9d58cb29de033cf049e
Last active April 23, 2021 19:45
Odds of winning constant probability games against one person

Probabilities and games.

Two simple games used to illustrate certain features of calculating probabilities are as follows:

You and a friend take turns flipping a fair coin. The first person to flip heads wins. If you go first, what are your chances of winning?

You and a friend take turns rolling a fair die with 6 sides. The first person to roll a 6 wins. If you go first, what are your chances of winning.

These end up being very similar problems, and can be generalized.

The likelihood of getting or beating an array of stats in D&D Part 2

Spencer R Hall

12/21/2020

So, after sharing my post from last week about probabilities and stat arrays. Now, the way I determine which array is better is clearly overly arbitrary. Under that system the standard array is better than an array of (7, 18, 18, 18, 18, 18), when in reality any player looking for maximal stats would take that over the standard array (8, 10, 12, 13, 14, 15). So maybe there is a different way to compare these.

Now the first approach would be to just take the ability modifier. Each integer from 3-18 maps to an integer from -4 to +4 that is used for almost everything in the game (except for carrying capacity, which uses the actual Strength score).

Now this is great, however I want to be thorough. While in terms of in-game actions, a 10 is no different from an 11, having a higher score makes it easier to bump up the Ability Modifier later when a character gets leveled. So let's use a modified scale. For the

@Heril
Heril / amongus.md
Last active December 8, 2020 02:35

Probabilities of Winning in the game Among Us

Spencer R Hall

12/07/2020

Back in August of this year, the game Among Us leapt in popularity. A social game where crewmates try to complete tasks while staying alive. At the same time, impostors try to kill off the innocent players while also sabotaging the crew. It's a fun, interactive twist on in person social games such as Werewolf or Mafia.

With the interactive gameplay, rounds end when a player reports a dead body or call an emergency meeting and the remaining players get a chance to discus and potentially vote out one player.

This got me thinking, ignoring the various strategies for the game, and avoiding where impostors kill off innocent players, if players were just removed/voted off randomly, what would be the odds of a crewmate or an impostor victory, and with that, the expected win rate overall.

@Heril
Heril / diceSimulationChiSq.md
Last active November 24, 2020 22:02
Simulating die rolls and testing fairness using a Chi-squared test.

Die Fairness in Dungeons and Dragons

Spencer R Hall

11/24/2020

As someone who enjoys playing Dungeons and Dragons, I also get fascinated by the primitive random number generators used it them, the dice. When I talk dice with friends and internet strangers, the conversation sometimes leans towards discussing whether or not their dice are fair.

Now if you search for how to test this, you can find a few good answers to explain the various statistical tests that can be used, along with their pros and their cons, so I'm not going to do that here.

While probabilities of several dice together can get messy really quickly without having to pull out a reference for my courses in Probability, one quick and dirty way we have of checking the odds of results is using simulations, and doing large simulations of die rolls is pretty quick on modern machines.