Maths Quiz

19 May 2016

Annddd…I am finally back after a loooong break!

Well, not exactly a break because I did a bunch of things since I last posted here :)

Let’s continue the naming convention and call it Day 24 project.

It is a maths quiz app which generates a random question & answer. You have to choose whether the displayed answer is correct or not before the time runs out. You lose if you choose an incorrect answer or if the time runs out.

Simple, right? Then give it a go here.

More about the app:

I keep the process random for these small apps. I begin with a rough mental image of what I want to make and refine it as I move. No planning, no freezing of specs, nothing at all. Just create three files - HTML, CSS and JS - and start coding.

I know that’s bad and that’s why I decided to change it this time. So before I began coding I actually wrote down what I wanted this app to do. Here are the requirements I came up with:

  • Timer starts running as soon as window loads and a random question is shown.
  • If user selects correct answer => generate next random question, update score and restart timer.
  • If incorrect answer or the time is over => game over screen and score is shown.
  • User can restart once the game is over.

That’s it. Just these four requirements which you can even see in the source code. This made the process so much easier to manage. It had all the same technical challenges but this time at least I knew what I was aiming for.

As usual the app looks simple from the outside but had its own challenges which you can never understand until to try to make it yourself. So go ahead and try recreating it and if you are stuck you can always view the source of my app. It’s well commented(I hope!).