We heard it was possible to do math with words, and after some experimenting figured it'd be a really fun game. So that's what we built.
What it does
It's a game that challenges one to do math with words. Can you write a wordy equation that equals "finger"? Hand minus palm plus thumb. Can you write an expression for "clouds"? Sky minus vapor plus droplets. How about a term for something that can't be constructed physically, say "solidarity"? Injustice minus inaction plus protest.
Oh, and you have to think of these in 30 seconds. While competing against friends for the most accurate equation.
How does it work? Our project uses word embeddings, where each word is represented as a 300-dimensional vector, allowing one to do all sorts of strange things with them, such as addition and subtraction.
It is your human inference skills versus the computer's linear algebra capabilities. Who will win?
How we built it
The backend uses Python, along with Flask for an API endpoint; the word mathematics was implemented using spaCy as a word embedding dataset and some optimized linear algebra from NumPy + SciPy. The frontend uses React + React-Router with the Chakra UI framework. Communication between the frontend and backend is done by a combination of a REST API and Socket.io realtime socket connections.
Challenges we ran into
When we were trying to set this up for Nix, due to issues with the packaging of spaCy we had to use a Python virtualenv and build a FHS user environment rather than simply including the Python packages we wanted. A bit impure, but it got the job done.
It was difficult to implement the word mathematics and the data science part of things, for two reasons: one of them was that we didn't really understand what we were doing, and several online resources describing how to use embedded vectors often neglected to mention critical implementation details that were essentially the data science equivalent of back-alley medical practices.
On top of all of this, we had to implement the live online game aspect, making sure that players' clients were synchronised with each other and the server, as well as implementing 'democratic' features (such as requiring half of all room members to be ready to start a game). Little sleep, but worth it.
Accomplishments that we're proud of
Apart from the linear algebra, we're very proud of the visual design of our game.
What we learned
We didn't know that words embedded as vectors had meaning before, and found it interesting that the human brain is able to do inference on a 300-dimensional vector space.
What's next for minusplus
A global leaderboard might be interesting. There are several more game types that can also be implemented with word math; for example, the reverse of the game (where you are given an equation and have to find a matching word), or the similarity:difference game (where you are given two words and have to find two words which are as dissimilar from each other as the two words are.)