Inspiration:

Times are very stressful right now, and having a simple game to play goes a long way. This school year, many students will not get a chance to bond with their classmates, as many schools have chosen to teach remotely. We decided to approach this problem in a different way: creating a positive bonding experience with users online. That positive bonding experience is our project, "21-Questions", which is an online game that can be played between any two users around the world. Not only does our project help users gain a positive social experience but it helps improve problem solving skills. The person playing as "Player 2" has to come up with creative questions that give any hints to the word "Player 1" is thinking about, while "Player 1" could increase the difficulty of the game by thinking of a uncommon word. This game could also be used in the classroom, particularly with elementary school kids, as a fun way to engage students in learning adjectives and other aspects of grammar!

What We've Learned:

Since this was a virtual hackathon, our team decided to create a work environment that solves problems like time zone conflicts and busy schedules. The experience was quite different from a normal hackathon as we had more time to process our thoughts and learn new material.

How We've Built:

We used the Python language to create our game. In order to make our game on an online platform, we decided to use Google Firebase's realtime database to keep track of important variables for both players to interact with; someone uploads a response and gets transferred to the second user through that common database. If any of the users want to restart the game, both of them simply 'exit' the match and the database variables will be reset back their original state.

Challenges:

The most difficult part of this project was to find a clean, easy-to-use interface to interact with the Firebase's REST API. We ended up using an open-source interfaced from GitHub, and this allowed us to focus more on the game logic instead of worrying about the environment set up. Here is the link to the Firebase interface repo on Github: https://github.com/ozgur/python-firebase. Using open-source was a great experience for us and we definitely will also try to immerse ourselves in the community.

Online 21-Questions Game

Welcome to our online game, 21-Questions! This is a python program that was developed and powered by Google Firebase's realtime database. This project was part of the 2020 HackIllinois' HackThis hackathon

How it works:

The online game works by having both players on the game transfer data between each other through the Firebase database. Player 1 choose a word which gets posted on the database that triggers Player 2 to start asking a question (which also gets posted on the database). The question then triggers Player 1 to respond to the question which then triggers Player 2 to ask a question again. It is a cycle which only ends when Player 2 runs out of tries or Player 2 guesses the word correctly

How to download:

  • Download Python 3 and PIP package manager. Here is a link for a video instruction
  • Next install the requests and python-firebase module by typing the following command in Terminal/Shell: bash pip install requests pip install python-firebase
  • Once python-firebase module is installed, located its directory on your computer and find the async.py file. Rename that file to whatever you like.

  • Afterwards open firebase.py and visit line 12 and replace the async to whatever you renamed the async.py file to It should like this:

    from .async import process_pool 
    
  • Now similar to the step above, visit the init.py file and replace the async word with whatver you renamed the file to. Don't forget to save changes

  • Make sure that you download the original file, main.py, from GitHub and copy-paste onto IDLE. Then hit "run module"!

  • You are ready to play!

Contributers: Rishabh Mehta, Natasha Mohanty

Built With

Share this project:

Updates