Skip to content

Instantly share code, notes, and snippets.

View jmanian's full-sized avatar

Jeff Manian jmanian

View GitHub Profile
@jmanian
jmanian / box_problem.rb
Created October 2, 2024 05:07
Box problem
# https://www.theguardian.com/science/2024/sep/30/did-you-solve-it-the-box-problem-that-baffled-the-boffins
def all_games
(0...15).to_a.combination(2).map do |prize_a, prize_b|
game(prize_a, prize_b)
end.tally
end
def game(prize_a, prize_b)
field = make_field(prize_a, prize_b)
# matchup format:
# favorite, underdog, p fave wins at home, p fave wins away, series score so far
matchups = [
# ['GSW', 'HOU', 0.87, 0.69, [0, 0]],
# ['SAS', 'MEM', 0.92, 0.78, [0, 0]],
# ['OKC', 'DAL', 0.82, 0.59, [0, 0]],
# ['LAC', 'POR', 0.71, 0.45, [0, 0]],
# ['CLE', 'DET', 0.80, 0.56, [0, 0]],
# ['TOR', 'IND', 0.79, 0.55, [0, 0]],
# ['MIA', 'CHA', 0.62, 0.35, [0, 0]],