What is the best programming language? Or, more generally, how do you combine multiple people's preferences to make a decision? Social choice theory answers these questions, but there are no open-source libraries available for it. We wanted to make that library, and also create an app to showcase its utility.
What it does
Shows users a ranking page, where they choose between two languages at a time, and select their favorite. Then, it shows a graph of all of the programming languages, and which beats which.
Computes and visualizes the outcome of elections. It supports multiple ways to aggregate votes, such as as Ranked Pairs, Copeland, and Win Ratio.
How we built it
We made a Flask app that was deployed on to a GCE instance. The app uses Jinja2 templated HTML for the frontend and Python as the backend. We implemented a standalone library for computing voting results that can be released for general use. The social choice mechanism library was implemented using networkx, a graph theory library for Python.
Challenges we ran into
- Needing to compile Python from source on a Google Cloud Engine instance
- Google Cloud Functions doesn't allow you to run Pygraphviz because it needs an external library, so we had to refactor everything to run on a GCE instance and set up network access
- Div alignment in HTML
Accomplishments that we're proud of
- Compiling Python from source on a Google Cloud Engine instance
- Solving graph theory problems to combine people's votes
- Solving graph theory problems to create a final graph with few enough edges to look pretty
- Creating a standalone library that creates rankings from votes using social choice theory
What we learned
- A lot about networking (ip 0.0.0.0 is how to broadcast, not 127.0.0.1)
- How to use python packaging tools to create a library
- How to use graphviz and its thousands of keywords
What's next for Tie Fightr
Make it easy for anyone to run any competition on the platform! Use it to make decisions about things like where to go out for dinner. Add more visualizations/rankings by different social choice mechanisms. Use our app for more important questions, like the best IDE/editor (hint: not vim or emacs, it's actually Google Docs).