Skip to content

Instantly share code, notes, and snippets.

@ashanalytics
ashanalytics / riddler-spelling.py
Created March 31, 2019 18:18
Solves the fivethirtyeight Riddler Classic from March 29, 2019
# -*- coding: utf-8 -*-
"""
Solves the fivethirtyeight Riddler Classic problem from March 29, 2019
Each speller is identified by their probability of spelling a word correctly,
such as "0.99" to represent a 99% correct speller. The program simulates a
large number of spelling bees and returns the winner of each bee.
"""
import numpy as np
@ashanalytics
ashanalytics / riddler-baseball.py
Created March 25, 2019 19:10
Solves the fivethirtyeight Riddler Express from March 22, 2019
# -*- coding: utf-8 -*-
"""
Solves the fivethirtyeight Riddler problem from March 22, 2019
Each inning is represnted by an object called "Inning", that is comprised of
strikes, outs, and runner positions, e.g. Inning(0, 1, (0,1,0)) for 0 strikes,
1 out, and a runner on second base.
There are 11 unique game actions that can occur. Each is represented by a
function that takes an inning state as input and returns a tuple of the new