Skip to content

Instantly share code, notes, and snippets.

View StewSchrieff's full-sized avatar

Stewart Schrieffer StewSchrieff

View GitHub Profile

Riddler Clasic

July 10, 2020

From Austin Shapiro comes a story of stacking that may stump you:

Mira has a toy with five rings of different diameters and a tapered column. Each ring has a “correct” position on the column, from the largest ring that fits snugly at the bottom to the smallest ring that fits snugly at the top.

Each ring she places will slide down to its correct position, if possible. Otherwise, it will rest on what was previously the topmost ring.

>For example, if Mira stacks the smallest ring first, then she cannot stack any more rings on top. But if she stacks the second-smallest ring first, then she can stack any one of the remaining four rings above it, after which she cannot stack any more rings.

stay_value 0.377298
switch_value 0.500682
dtype: float64
@StewSchrieff
StewSchrieff / 1_explanation.md
Created January 7, 2020 03:54
Riddler_Express_Flag_Scramble

Riddler Express

Late night quick coding challenge. Read in all the pixels of the scrambled images, rudimentarily sort them, and then send them back out as images. This will give you a much better idea of what colors you are actually looking at, and can eyeball what the answers might be.

Code runs on both png and gif filetypes, so you can just download the images and go!

@StewSchrieff
StewSchrieff / 1_probability.py
Last active January 14, 2020 17:39
Riddler (Find Your Favorite Song) 2019-12-06
def get_chance_of_better_than_next_on_next_roll(num):
# this is a sliding scale
return (42 - num - 1) / 100
def get_prob(num):
if num == 41:
return 0
prob = get_chance_of_better_than_next_on_next_roll(num)
return prob + ((1 - prob) * get_prob(num +1))
import numpy as np
import matplotlib.pyplot as plt
# Note that each inning is independent, so we only need to simulate one inning at a time
moonwalkers = {
'name': "Mississippi Moonwalkers",
'color': 'blue',