Portfolio

Powers of 2 Challenge

Next.jsSupabaseSQL
Project image: Powers of 2 Challenge

Description

At the start of my first year in a BUT Computer Science program, we were asked to learn all the powers of 2 up to ten by heart, in order to quickly perform certain operations and conversions during exercises and some exams. That gave me the following idea: find a fun, repetition-based revision system to learn the powers of 2 without even realizing it. I drew inspiration from a habit I had observed in a friend, who had become very good at mental math thanks to an app that generated small problems to solve within a time limit, with a ranking system. It created a kind of competition between players, each trying to be the fastest depending on the category and difficulty of the calculations. It was from this observation that I decided to implement a mini-game to practice calculating powers of 2. The game has a stopwatch that records the time taken to answer, as well as a leaderboard. The leaderboard is updated when a player saves their score using their university student email address, after checking that the address ends with "@etu.univ-lyon1.fr" and follows the standard email format (firstname.lastname[optional number]@...). Thanks to this address being standardized for all students, I can deduce their first and last name, which I store in a database along with their best time. If a player beats their previous record, the time is updated automatically. I then ran into a significant problem: the challenge's responsiveness and fairness between different devices. In the first version, desktop users had an advantage. As soon as the calculation appeared, they could type the answer directly on their numeric keypad, whereas phone players first had to tap the answer field, bring up their keyboard, then switch it to numeric mode before starting to type their number. This cost them about a second, which completely skewed the comparison of times. Two solutions were available: detect the moment a mobile user started typing their first digit, or recreate a numeric keypad directly on the site, like a small calculator, displayed only on phones once the calculation appears. As you might guess, I chose the second option, because the first did not account for the mobile player's thinking time. As I write these lines, the mini-game has not been a resounding success, probably because learning the powers of 2 up to 10 is fairly easy. Nevertheless, this project taught me a lot: managing a database connected to a website (a first for me), taking technical constraints and fairness between devices into account, and above all the satisfaction of having carried a concrete idea through. It remains a rewarding experience I am proud of.

Gallery6 images

Powers of 2 Challenge | Portfolio Dev | Portfolio Dev