This past week, I released a project that I’ve been working on for a while that brought together a major change to the lucking winning games in the world amazing (if I do say so myself).
The project allows you to guess numbers rightly based on the level you choose. As an engineering problem, I wanted to focus on 2 things: creating an experience that would be both web and mobile-friendly, and also allowing players to win easily.
Oddly enough, I only have little interest in guessing games like this, even though my project is all about guess game. I had decided very early on that I wanted to work build a gaming company, and needed a reason to use it. A few weeks ago I had lunch with a childhood friend of mine to brainstorm project ideas and he described a problem he faces every day: He enjoys playing games but when I think about it, is there a specific reward given to him for successfully completing a level? I learned this about myself– it’s interesting to play games but a lot more interesting when there’s a reward attached to winning. For the entirety of this project, I’ve been working closely with him to make thee project a success working from home!
I wanted to share my story around how I came up with this idea, worked to make it happen while still doing my day job, learning, and what the results looked like.
For the Frontend, I chose to use Streamlit python with combination of HTML5, CSS3 and JavaScript without any additional frameworks. I opted not to use other frameworks because I wanted to dedicate my time to solidifying my understanding of python.
The website is responsive and compatible with mobile. This means players can access the project from a mobile view as well as desktop!
How To Play
- As the player is granted 10 chances at the easy level, the game will iterate from 1 to 10 to determine if the entered number matches the actual secret number (1 to 24). Since the player has only seven choices in level medium, the game will iterate from 1 to 7 to check if the number matches the secret number.It will iterate from 1 to 5 if the player selects hard level since there are only 5 choices.
- The game will display that the secret number is smaller than the chosen number if the entered number is smaller than the secret number.
- Whenever the entered number exceeds the secret number, the game will display that the secret number is greater, which serves as a hint for the player.
- The game will also display the number of choices left.
- Once the number entered matches the secret number, the player will be notified that he has won and unlocks the mysterious coin
- The game ends if the player cannot guess the number and he or she has no more choices left. This terminates the game.
I first wrote the program in C then C++. But I don’t know how to make it accessible for people to play and win on web application. So now, I now decided to rewrite the game function in python which is the source code I sent to you. It’s working perfectly when I run it on my terminal.
Now, I used streamlit to build the Frontend of the web application of the game to make it accessible for people to play directly through the website with python. Now, the issue I I had was integrating the game function so that when people click on play now, it triggers the game function and people can play it directly on the website.
Early in the project I had decided to provide a feature for players so that they could play the game and win a prize easily. I set out to research the different types of ways to implement this features and what type of prize to give them and as well making sure the game is available for players to easily win prize. To implement the prize winning with guess, I realised my project needed to implement blockchain technology by giving the users tokens once they have successfully win the guess game.
So technically, I knew I will have to use smart contract for the prize to give the players and streamlit to develop the front-end application with python script for the gaming logic. Then deployed on heroku server. With only 3 days left for my project, I reached out to some of my peers and the technical staff to assist me with integration of the gaming logic. I followed this tutorial [https://youtu.be/RjiqbTLW9_E] and ran into an issue with the gaming logic integration with the front-end of the website. Here’s an illustration of the image:
I reached out again to Google blogs and articles for me to be able to fix the issue. I spent several days and time to try solving the issue but all to no avail. With only 5 hours before my presentation, I managed to get the Facebook OAuth working and managed to even shower before the presentation!
If you, your family, or your friends like Number Guess Game, this is the game for you. I can’t wait to see you try your luck today!
Thanks for reading!