Skip to content

Instantly share code, notes, and snippets.


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.

View 01_output.txt
stay_value 0.377298
switch_value 0.500682
dtype: float64
StewSchrieff /
Last active Jan 14, 2020
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))
StewSchrieff /
Created Jan 7, 2020

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!

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',
You can’t perform that action at this time.