Create a gist now

Instantly share code, notes, and snippets.

@awwaiid /bracket.rb
Last active Mar 16, 2017

games = [
{name: "Villanova", seed: 1},
{name: "MSM", seed: 16},
{name: "Wisconsin", seed: 8},
{name: "Virginia Tech", seed: 9},
{name: "UVA", seed: 5},
{name: "UNC Wilmington", seed: 12},
{name: "Florida", seed: 4},
{name: "ETSU", seed: 13},
{name: "SMU", seed: 6},
{name: "PR / SC", seed: 11},
{name: "Baylor", seed: 3},
{name: "New Mexico St", seed: 14},
{name: "South Carolina", seed: 7},
{name: "Marquette", seed: 10},
{name: "Duke", seed: 2},
{name: "Troy", seed: 15},
{name: "Gonzaga", seed: 1},
{name: "South Dakota St", seed: 16},
{name: "Northwestern", seed: 8},
{name: "Vanderbilt", seed: 9},
{name: "Notre Dame", seed: 5},
{name: "Princeton", seed: 12},
{name: "West Virginia", seed: 4},
{name: "Bucknell", seed: 13},
{name: "Maryland", seed: 6},
{name: "Xavier", seed: 11},
{name: "FSU", seed: 3},
{name: "FGCU", seed: 14},
{name: "Saint Mary's", seed: 7},
{name: "VCU", seed: 10},
{name: "Arizona", seed: 2},
{name: "North Dakota", seed: 15},
{name: "Kansas", seed: 1},
{name: "NC / UD", seed: 16},
{name: "Miami", seed: 8},
{name: "Michigan State", seed: 9},
{name: "Iowa State", seed: 5},
{name: "Nevada", seed: 12},
{name: "Purdue", seed: 4},
{name: "Vermont", seed: 13},
{name: "Creighton", seed: 6},
{name: "URI", seed: 11},
{name: "Oregon", seed: 3},
{name: "Iona", seed: 14},
{name: "Michigan", seed: 7},
{name: "Oklahoma State", seed: 10},
{name: "Louisville", seed: 2},
{name: "Jacksonville St", seed: 15},
{name: "UNC", seed: 1},
{name: "Texas Southern", seed: 16},
{name: "Arkansas", seed: 8},
{name: "Seton Hall", seed: 9},
{name: "Minnesota", seed: 5},
{name: "Mid Tennessee", seed: 12},
{name: "Butler", seed: 4},
{name: "Winthrop", seed: 13},
{name: "Cincinnati", seed: 6},
{name: "KSU", seed: 11},
{name: "UCLA", seed: 3},
{name: "Kent State", seed: 14},
{name: "Dayton", seed: 7},
{name: "Wichita State", seed: 10},
{name: "Kentucky", seed: 2},
{name: "N Kentucky", seed: 15},
]
while games.length > 1
team1 = games.shift
team2 = games.shift
print "#{team1[:name]} vs #{team2[:name]}: "
weighted = ([team1] * (17 - team1[:seed])) + ([team2] * (17 - team2[:seed]))
winner = weighted.sample
puts winner[:name]
games.push(winner)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment