I spent a few hours coding Mathle, which is a mathy version of Wordle.
The idea came after I came across Primel (find a 5-digit prime number in 6 guesses) and struggled to solve it.
The whole page is implemented with React (specifically Next.js). Here are a few lessons I learned about developing a
simple game from idea on the paper to actual page and the launch:
-
TypeScript makes it easier to abstract certain parts with types. For example, I have an enum Color to
represent the cell color, or a type RowSolution to represent the actual solution. Use types where useful, otherwise ignore it (remember, the goal is to have a working prototype)
-
TypeScript type warnings with React are annoying. Fall back to @ts-ignore. I was using a mix of typed functional components and untyped functions.
-
Ignore the user interface and focus on a bug-free proof of concept.
I spent too much time making everything pretty, but spend another few hours fixing and introducing more bugs:
-
If it is easier to do it by hand, then don't automate. For now, I generate a puzzle once a day and re-publish the whole project.
I did not find an easy way (since the whole page is on the client-side) to provide the solution to the puzzle.
The next task is to automate this process.
-
Check on HackerNews if anyone launched a similar project: When I submitted my project to HN, there were three other projects related to Wordle 🤦.
-
Take more screenshots and document the process better next time. That way this article would contain more pictures.
- It is possible to "hack" something workable in 5h and spend another 6h fixing all the bugs.
-
Don't buy a domain for each project. Actually, this is something obvious for everyone, but I am a domain-buyer-and-never-user.
Too many domains expired without any associated projects being born, so I decided to publish this project as a subdomain.
That saves me money and reduces the struggle of setting it up each time.