Inspiration
As this was our first hackathon, we wanted to create a program that included something we all enjoy and are passionate about, which is playing and watching sports. Therefore, we took this as our starting point and eventually decided to create a program that pit celebrities against each other in various activities.
What it does
Our program takes two celebrities (athletes, actors, politicians etc.) and pits them against each other in an odd activity. Then, it will output the celebrity that would most likely win the activity by comparing different attributes of the celebrities that are needed to complete the activity successfully.
How we built it
We built this by creating a data set of celebrities and their attributes such as height, speed, intelligence etc. which are scored from -10 to 10 depending on the celebrities' level of the attribute. We also created another data set for the activities that could take place. Some of the activities include: a rap battle or an egg and spoon race.
These activities include some of the attributes the celebrities have, depending on which of the attributes are needed to perform the activity the best. For example, for a rap battle, intelligence is one of the attributes that would be used to compare the celebrities.
We also had to add a weight to each activity as not all attributes would contribute equally to the success of the activity. For example, for the egg and spoon race, it has the attributes speed and balance, but balance has a higher weighting than speed as the egg has to stay on the spoon.
To calculate a celebrity's score for how well they would perform the activity, their value of the required attribute is multiplied by the weighting and to simulate unpredictable events that can affect their performance, a random number between -2 and 2 is generated and then added to the celebrity's total score. This is done for both celebrities, so both their scores can be compared to find the winner between them.
A message is generated telling the user which celebrity has won. This message is created by a specific Gemini model which is done by initialising the Gemini API client in the python environment:
'''
api_key = os.environ.get('GEMINI_API_KEY')
if not api_key:
raise ValueError('Missing GEMINI_API_KEY in environment!')
client = genai.Client(api_key=api_key)
'''
The message is generated from a prompt and constraints are set so an appropriate message is produced.
We decided to use a webpage to display our project on so we created one using HTML, CSS and JavaScript. We formatted the webpage so that it included a main header of "Who will win?" and a small description of what the program can be used for. Using drop-down lists, the user will then be able to choose two celebrities out of twenty-five to go up against each other in the user's chosen activity which is also chosen with a drop-down list of all the available activities. When the user has chosen their desired celebrities and activity, then they can press the "shake" button which will prompt the crystal ball underneath to shake and output the winner to the activity. CSS is used to centre the objects and change the appearnace so that it's more engaging. JavaScript is used to shake the crystal ball when the scores are being calculated to make it more interactive. As we coded the comparison engine in python, we also required to use JavaScript to link the HTML and python code together.
-- LINKING HTML AND PYTHON --
Challenges we ran into
One of the challenges we ran into is creating the data set of celebrities with all of the required attributes. This was because we wanted the attribute to store a rating and not the information. For example, for height, if a male had a height of 184cm, as this is over the average male height (178cm), the attribute would store a positive rating of 5, instead of 184cm itself. This meant we had to score the attributes based on relevent data found on the Internet. This became a challenge as we had to filter through the data to find relevant pieces and then

Log in or sign up for Devpost to join the conversation.