A simple web app designed to help players of the board game Root in selecting a four-player faction combination. This tool takes each player's top four factions and uses a custom algorithm to suggest the best possible combination based on prioritizing their top factions and balancing the game using Roots recommended "reach" values for a four player game.
Note: Players 2, 3, and 4 were prefilled to shorten demo.
- Allows four players to rank their top four factions.
- Integrated algorithm generates an optimized list of faction combinations based of player preferences and recommended reach values from the game designer.
- Displays the top three recommended combinations, including a "Satisfaction" score and "Reach Difference" metric.
- Backend: Python with the Flask framework.
- Frontend: Standard HTML and CSS. The page is rendered using Jinja2 templating.
- Algorithm: The core logic for choosing the best combinations is handled by a custom Python module.
This guide will walk you through the steps to get the app running and ready for use.
- Download the project as a ZIP file and extract it.
- Open your terminal or command prompt, and navigate to the project folder.
- Install the necessary dependencies by running: pip install Flask.
- Launch the app by running: python app.py.
- Open your web browser and go to the address provided in your terminal (e.g., http://127.0.0.1:5000).
- On the app's homepage, enter your name and rank your top four preferred factions. Note: Factions must be entered by their animal name (e.g., "Cats," "Eyrie," "Vagabond").
- Once all preferences have been entered, click the Muster the Factions button.
- The page will instantly update with the top three recommended faction combinations.
This project taught me about greedy algorithms, which are a class of algorithms that make the locally optimal choice at each step in the hope that it will lead to a globally optimal solution. The faction-choosing algorithm in this project uses a greedy approach to find the best possible compromise between player satisfaction and game balance.
This project served as a foundational exercise in web development, providing extensive experience with Flask, a Python micro-framework. I learned how to handle HTTP requests (GET and POST), process form data, and render dynamic HTML pages using Flask's templating engine.
Through the development of this project, I gained a lot more experience with the core web technologies of HTML and CSS. I learned how to structure a complete web form with HTML and then use CSS to style it.
The current application assumes all user inputs are valid. Implementing error handling would make it more robust. This could include adding checks for invalid faction names, and displaying user-friendly error messages if issues are found.
Future improvements could include adding a button to dynamically add more players, implementing a feature to save and load preferences, and adding a simple visual chart to display a comparison of the top faction combinations.
