What started a few days ago as a desire to try coding something in JavaScript has now turned into a full-fledged single page application with major feature additions and changes happening almost daily. Seeing as it’s evolving so quickly, I thought I’d try writing a little about it, so that what it was won’t eternally be forgotten, except for an old commit buried in a private Git repository.
So as of writing this, the application is live at play.kilumanga.com. It’s quite simple - only a header for navigation between the two routes (/
and /hitandblow
), with a third route only available in the development build (stay tuned!).
Right now, what’s interesting is the second route, /hitandblow
, which essentially is a game with an animation that plays when you beat it. The game is a number-guessing game introduced to me by my wife. What with her basically being Rain Man when it comes to puzzle games, I wanted a tool to help me gain an advantage; perhaps even code an algorithm to play the game perfectly. Nonetheless, for starters, I decided to code a playable version of the game. Full disclosure: this is not my first time coding it. I once wrote it as an Android app, and asked my interns at work to try it. They did, and let me know it was known as Hit and Blow in Japan. Turns out it’s known as Bulls and Cows in the rest of the world.
Anyways, the game’s rules are simple. Here’s how you play it:
- The game randomly generates a 4 digit secret number
- Input 4 unique digits
- Each digit in your guess that both match in number and position with the randomly generated number gives you an “A”
- Each digit in your guess that match in number but not in position with the randomly generated number gives you a “B”
- The results are presented in the format “1A1B”
Here’s a GIF showing what the game looks like today: