Lights Out Android App
My Lights Out app is based on the 1995 handheld electronic game by Tiger Electronics of the same name. In the 1995 version, the game board consists of a 5x5 grid of lights, and then when game starts, a seemingly random pattern of lights is presented to the player. The player's objective is to toggle lights to turn all the lights off with button presses, preferably in as few presses as possible.
When a light is pressed, the on/off state of the pressed light and all directly adjacent lights are toggled.
Although similar handheld games and apps already exists. There are two things that I believe make my app unique: variable board sizes, and mathematical optimization.
Variable Board Sizes
Many of the apps available today only feature a single board size, usually the classic 5x5. This makes the app less challenging once the user finds a reliable method for solving the single board size and limits the number of possible scrambles. For the 5x5 board, there are 223=8388608 distinct ways to create a scramble. However, there are at least 4 different ways to create any given scramble, leaving at most 219=524288 unique scrambles. All of these scrambles can be solved in at most 15 button presses.
My app allows user to play any board size from the trivial 1x1 to the daunting 10x10, providing orders of magnitude more unique scrambles than the 5x5 alone. I would have allowed even larges sizes, but the buttons were getting too small to reliably press.
In fact, just the 10x10 size has 2100, over 1 nonillion unique scrambles. For comparison, if each unique board were printed on a sheet of paper 0.1 mm thick, the stack of paper would reach to the edge of the observable universe 13.4 billion light years away.
Users have yet another dimension opened to them in being able to play by only pressing buttons that are already on. Although all puzzles that can be solved normally can also be solved by only pressing on buttons, it makes for a much more difficult challenge because the way that most learn to solve the 5x5 board requires pressing off buttons.
I already mentioned how any 5x5 board can be solved in at most 15 button presses. Puzzle enthusiasts and recreational mathematicians like Jaap Scherphuis proved this to be the case. Jaap in particular uses a method of treating solving the board as a linear algebra problem that is described by mathematician Marlow Anderson and Todd Feil in their 1998 paper Turning Lights Out with Linear Algebra.
I implemented Anderson and Feil's method of row reducing matrices modulo 2 to determine the minimum number of clicks needed to solve any given board. This way users can know how their solve is compared to the absolute best they could do.
Although this value is only one number on a screen, I think it provides valuable information to users about a given puzzle's difficulty and their own solving abilities that no other app has.
Air Quality Tracking & Prediction
India suffers over 1 million pollution deaths per year, the most in the world. If Indian air quality was at the same level as the United States, the average life expectancy in India would increase by 1.7 years. Without accurate real-time and forecasted air quality, residents don't have the tools they need to make decesions for their health.
This is the problem my team and I tackled during HackNC 2020 with our hack, SeeO2. We wanted to create a simple way for users to see past, present, and future air quality information for where they live. We also wanted to provide tips based on the air quality level, like staying indoors or buying a filtration system, that users could follow to protect their health.
The frontend was done in React, with some components being borrowed from other projects and repurposed. We got current information from Open Weather Map and Ambee APIs. For past air quality and future predictions, I created our own API in Python using Pandas, Flask, and SciPy, which analyses a Kaggle Data Set and is hosted on Heroku. You can check out our work on Devpost and GitHub.
We were very satisfied with the result and happy that the app won several awards, including Best Hack for Sustainability and Top 20 Hack. In the future, we may expand the app's functionality by providing interactive plots of air quality over time and using more advanced prediction methods.
Although you are already viewing the website, all the code is available on GitHub.
While taking a summer physics class dealing with multivariable calculus, I realized how much of the subject I had forgotten even though I took multivariable calculus class (Calc III) only nine months earlier. I also knew that several of my friends who would be taking Calc III in the coming semesters had already requested my notes and advice about the class.
However, I like to keep my notes, which can be hard for others to read, as a reference. I decided to digitize my notes using LaTeX in an abridged textbook structure. I would also add better visual aids than the hurriedly-drawn sketches in my nodes. This way, I could easily share clear and legible notes, keep the my original notes, and refresh my own understanding. By the time I was finished, I had condensed the several thousand page textbook into an 81 pages that covered almost all topics mentioned in class while still containing many visual aids and full length proofs. I feel much more confident in my abilities, and I think my friends will be able to learn from me much more easily.
After completing my notes, I posted the results to r/math, an online community of math enthusiasts. To my surprise my post was incredibly well received, and several users suggested open sourcing my work so that others could help make corrections and suggest additions. The repo is available and has already taken several community contributions.
I've begun expanding the scope of the project beyond multivaraible calculus. I recently completed a 92-page summary of introductory differential equations, and hope to start working on a similar document for linear algebra. Due to user suggestions, a summary of single variable calculus is also forthcoming.
Twitter Bad Words Bot
The specific words that people choose to use can provide insight into their background and character. Although reasonable people can vehemently disagree, a good indicator of mutual respect between two parties is that neither resorts to vulgarity. Inspired by other bots on platforms like Reddit and Discord that could provide information on the language that users have used and play a part in keeping online discussion civil, I set out to create a Twitter bot that when called upon by a Twitter user would provide information on vulgarities that a requested user had recently tweeted.
Bad Word Count Bot Report for @badwordsmovie's last 100 tweets— Bad Word Count Bot (@BadWordCount) October 9, 2019
bitch - 3
hell - 3
fucking - 2
fuck - 2
ass - 1
cunt - 1
fucker - 1
damn - 1
tits - 1
asshole - 1
shit - 1
I wrote the bot in Python, following basic online video tutorials that detailed how to work with the Twitter API through the Python library tweepy. Although these tutorials showed me how to detect when a user had @ mentioned the bot and how to respond to tweets, the real challenge and substance of this bot came from accessing another user's tweets, parsing through them to find bad words, and reporting the frequency of these bad words within the 280-character limit of a Tweet.
After finding separate answers on how to access a given user's tweets, I got to work on detecting bad words. Although I found several GitHub repos that contained lists of bad words, many were too comprehensive, marking even words with possible negative connotations, like the names of political parties, as bad. I eventually settled on a list of 444 common words collected by Google. This list was comprehensive enough to cover most bad word, and even common variations like swapping a letter for a number. On the implementation side, I took advantage of Python's built in dictionary functionality to find matching bad words in a user's 100 most recent tweets and rank them by frequency.
The bot is currently not deployed. I hope to find a long term, affordable, and reliable deployment solution.
The bot's Twitter handle is <a href="https://twitter.com/BadWordCount" , target="_blank" >@BadWordCount</a >. Go ahead and try it out on some of your favorite twitter users. The tweet shown above is from a movie starring Jason Bateman. The code that the bot is running is on my GitHub.
Jeopardy! has for a long time been one of my favorite TV game shows. I enjoy how the game is mostly skill based and I always learn something new when I play along. When I heard about the free JService API from a friend, I thought this would be a fun opportunity for me to learn about interacting with APIs.
The biggest issue came from some unavoidable problems with the JService API. For API problems, some Jeopardy! clues use sounds or videos as clues, the gimmick of certain categories are also hard to understand without an explanation from the host. JService provides access to neither of these things. Although JService has made an effort to remove these sorts of clues from its dataset, some still remain. Further, the answers to certain clues sometimes contain extraneous words like "a" or "the". To avoid the user being penalized for responses that aren't letter for letter perfect, I've included an "I'm Right" button that gives the user credit for an answer that doesn't exactly match the one provided by JService. Another big difference between traditional Jeopardy! gameplay and mine is that I don't require users to answer in the form of a question. This matched the form in which answers were sent by the API.
Computer Generated Art
For example, the left image below visualizes how numbers change after a given number of iterations in the unsolved Collatz conjecture; it has been my phone background for several years. For a more artistic visualization, see the right image below, which applies a smeared watercolor effect.
One can also visualize more useful and common mathematical ideas. The left image below shows how horizontal and vertical lines in the complex plane are transformed under e^(1/z). One can clearly see concentric cardioids. The right image below shows the graph of several common functions, like sine and the natural logarithm.
The Turtle library allows one to trace out colored paths in an image, like the rainbow spiral no the left below. Getting a little more advanced, one can create recursive shapes, like the Koch Snowflake, Seirpinski Triangle, and dragon curve, shown below.
One can also make other startlingly complex images from a simple set of recursive rules. The below images, known collectively as "strange attractors," show a tree, Barnsley Fern, pine branch and piece of tall grass. The procedural generation techniques used to create these images, known as L-systems, are used in many of today's popular video games to make random, realistic terrain and plants.
The images above and many others that I made in Python, as well as the code used to create them, are available on GitHub.