I hereby claim:
- I am rvcx on github.
- I am rvcx (https://keybase.io/rvcx) on keybase.
- I have a public key ASC8ykLZ-GbgjAJfgJhh1GlY5mTCNCABKaj2PK-_0NDiiAo
To claim this, I am signing this object:
# https://twitter.com/rvcx/status/813081772288278528 | |
# http://fivethirtyeight.com/features/build-your-own-death-star-and-defeat-the-stormtroopers/ | |
from math import sqrt | |
from random import random | |
def simulate(n, k, base_rate): | |
while n: | |
# each storm trooper shoots | |
for i in range(n): |
#!/usr/bin/env python3 | |
import random | |
def simulate(num_players): | |
players = { i : [] for i in range(num_players) } | |
tags = 0 | |
while len(players) > 1: | |
tags += 1 | |
(tagger, taggee) = random.sample(players.keys(), 2) |
2 1.0 | |
3 3.018 | |
4 7.078 | |
5 15.953 | |
6 30.996 | |
7 64.136 | |
8 136.031 | |
9 254.142 | |
10 492.412 | |
11 1027.277 |
def simulate(strategies, turns): | |
pot = 1.0 | |
players = [ [s, 0] for s in strategies ] | |
for i in range(turns): | |
p = random.choice(players) | |
if p[0] > pot: | |
pot = 1.0 | |
else: | |
p[1] += p[0] | |
pot -= p[0] |
#!/usr/bin/env python3 | |
# Simulator for https://fivethirtyeight.com/features/who-steals-the-most-in-a-town-full-of-thieves/ | |
import random | |
import statistics | |
def simulate(k): | |
assets = [100 for i in range(k)] | |
for robber in range(k): |
import random | |
def simulate(needed, win_pct=0.6): | |
losses, wins = 0, 0 | |
while True: | |
if random.random() < win_pct: | |
wins += 1 | |
else: | |
losses +=1 | |
if wins > needed: |
#!/usr/bin/env python3 | |
import argparse | |
import sys | |
import random | |
def simulate(accuracy, goal): | |
i, streak = 0, 0 | |
while streak < goal: | |
i += 1 |
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env python3 | |
import argparse | |
import sys | |
import random | |
from operator import add | |
def simulate(dwarves): | |
beds = set(range(1, dwarves)) | |
beds.remove(random.sample(beds, 1)[0]) |
#!/usr/bin/env python3 | |
import argparse | |
import sys | |
def main(): | |
for pop in range(101): | |
for v1 in range(pop + 1): | |
v2 = pop - v1 | |
if v1 // 10 == v2 % 10 and v1 % 10 == v2 // 10: |