Last active
March 17, 2016 18:29
-
-
Save mbaltrusitis/65816f994b58acb9bae4 to your computer and use it in GitHub Desktop.
A random bracket selector.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
"""Randomly select your March Madness bracket. | |
""" | |
import random | |
south = ( | |
( | |
( | |
('Kansas', 'Austin Peay'), | |
('Colorado', 'Connecticut'),), | |
( | |
('Maryland', 'South Dakota St.'), | |
('California', 'Hawaii'), | |
) | |
), | |
( | |
( | |
('Arizona', 'Vanderbilt/Wichita St.'), | |
('Miami', 'Buffalo'), | |
), | |
( | |
('Iowa', 'Temple'), | |
('Villanova', 'UNC Asheville'), | |
) | |
) | |
) | |
west = ( | |
( | |
( | |
('Oregon', 'Holy Cross/Southern'), | |
('Saint Joseph\'s', 'Cincinnati'),), | |
( | |
('Baylor', 'Yale'), | |
('Duke', 'UNC Wilmington'), | |
) | |
), | |
( | |
( | |
('Texas', 'Northern Iowa'), | |
('Texas A&M', 'Green Bay'), | |
), | |
( | |
('Oregon St.', 'Virginia Commonwealth'), | |
('Oklahoma', 'Cal St. Bakersfield'), | |
) | |
) | |
) | |
east = ( | |
( | |
( | |
('North Carolina', 'FGCU/Fairleigh Dickinson'), | |
('USC', 'Providence'),), | |
( | |
('Indiana', 'Chattanooga'), | |
('Kentucky', 'Stony Brook'), | |
) | |
), | |
( | |
( | |
('Notre Dame', 'Michigan/Tulsa'), | |
('West Virginia', 'Stephen F. Austin'), | |
), | |
( | |
('Wisconsin', 'Pittsburgh'), | |
('Xavier', 'Weber St.'), | |
) | |
) | |
) | |
midwest = ( | |
( | |
( | |
('Virginia', 'Hampton'), | |
('Texas Tech', 'Butler'),), | |
( | |
('Purdue', 'Little Rock'), | |
('Iowa State', 'Iona'), | |
) | |
), | |
( | |
( | |
('Seton Hall', 'Gonzaga'), | |
('Utah', 'Fresno St.'), | |
), | |
( | |
('Dayton', 'Syracuse'), | |
('Michigan St.', 'Middle Tennessee'), | |
) | |
) | |
) | |
tournamet = ( | |
(south, west), | |
(east, midwest) | |
) | |
def find_winners(tourny): | |
left, right = tourny | |
if isinstance(left, tuple) and isinstance(right, tuple): | |
left = find_winners(left) | |
rght = find_winners(right) | |
final_faceoff = (left, rght) | |
winner = find_winners(final_faceoff) | |
return winner | |
if isinstance(left, str) and isinstance(right, str): | |
print("\n\n{} VS. {}".format(left, right)) | |
winner = random.choice([left, right]) | |
print("{} wins!".format(winner)) | |
return winner | |
if __name__ == '__main__': | |
print("thinking...") | |
final_winner = find_winners(tournamet) | |
print("\n\nTHE BIG WINNER IS {}".format(final_winner.upper())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment