Amani profile photo

Amani

Thoughts, realizations, accomplishments

Amani Kilumanga

2 minutes read

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:

  1. The game randomly generates a 4 digit secret number
  2. Input 4 unique digits
  3. Each digit in your guess that both match in number and position with the randomly generated number gives you an “A”
  4. Each digit in your guess that match in number but not in position with the randomly generated number gives you a “B”
  5. The results are presented in the format “1A1B”

Here’s a GIF showing what the game looks like today:

Categories

About

A creative and meticulous Software Engineer who is passionate about delivering robust and general solutions through an iterative development process.