Anirudha
← Work
15 Days of CodingDay 14September 25, 2025~3 min read

Higher or Lower Game

Always iterate and keep refining your logic

After yesterday’s relaxing session, today was about building something my own from scratch again. To do that, I worked on the Higher or Lower Game. You can try the original game here.

If you don’t know the game, I will walk you through it. The game shows you two random personalities, brands, or entities, and you have to guess which one has more followers. Each correct guess increases your score, and the game continues until you get it wrong. Once you get it wrong, you have to start from 0 again.

While writing the code, a few interesting observations stood out:

  • Too many ifs at first: My first draft had three separate if conditions (A correct, B correct, wrong guess). It made the code unnecessarily long, until I realized I could combine the first two into a single condition. Cleaner and easier to read.
  • Keeping the game alive: I struggled a bit with making the game restart after a loss. Initially, I tried putting the restart logic outside the while loop, but it broke the flow. Moving it inside the while loop solved the problem.
  • Loops over static logic: My very first version didn’t use a function or loop. It just ran directly with my three if statements. Revising it with a while loop made the game reusable and continuous.
  • Scope lesson: At first, I generated the random A and B choices outside the loop. That put them in global scope, which caused issues inside the function and I couldn’t use them. Once I moved them properly inside, everything clicked.
  • A sneaky bug: Sometimes the computer picked the same option twice for A and B. I fixed it with a simple check to guarantee unique choices.

The insight for me today was that writing a game isn’t just about making it work. You might think “as long as it runs, it’s fine.” But that’s only the first step. Once you build your MVP, the real learning happens when you iterate and refine your logic. It strengthens your coding muscle and gives you room to use your creative side to find simpler, more elegant solutions.

With the game done, it’s time for a run. It rained all day, but the skies have finally cleared and the weather looks perfect. On the plan: a 30-minute fartlek session to build endurance. Hopefully I can keep going the whole time without stopping. Let’s see.

Until tomorrow!