You're reading: cp's mathem-o-blog, Features

Take the 30 second arithmetic challenge

My wife’s grandmother is a fearsome character. She’s in her nineties but still has all her wits about her. In fact, she’s got more than her fair share of wits. Whenever we visit her, she hits me with a barrage of questions and puzzles collected from the last several decades of TV quiz shows and newspaper games pages. My worth as a grandson-in-law is directly proportional to how many answers I get right.

One of her favourite modes of attack is the “30 Second Challenge” from the Daily Mail. It looks like this:

quiz0512_800x310

You start with the number on the left, then follow the instructions reading right until you get to the answer at the end. It’s one of Grandma’s favourites because it’s very hard to do in your head when she’s just reading it out!

I decided it would be a fun Sunday morning mental excursion to make a random 30 second challenge generator

Making a random challenge generator involves thinking about what the space of possible challenges is, and how to pick fairly from them corresponding to different difficulty levels. The strategy I came up with is for each difficulty level to have a pool of possible operations, and to pick at random from those for each step. An operation can involve more than one step, and each operation has a function which looks at the current state of the puzzle to decide if it can be applied.

As far as I know, each operation must leave you with a whole number. That means that a “divide by $N$” instruction can only appear when your number is divisible by $N$. Since some divisors are much more common than others, but I wanted to have a good distribution of numbers to divide by, I made the divide by” operation pick a number $N$, and then add a step to add or subtract the right amount to get to a multiple of $N$, before adding the step to divide.

Some pairs of operations shouldn’t appear next to each other – you shouldn’t get an “add” followed by a “subtract”, or a “halve it” followed by a “double it”.

With a rough system of making valid challenges in place, I needed to make three difficulty levels. My rough rule of thumb was that dividing is really hard, cubing is hard because it leads to big numbers, and adding and subtracting are quite easy. I could probably split the additions or multiplications into easier or harder versions – there’s some evidence that the 6 and 8 times tables are hardest – and add some more complicated operations like “square root of this”. At the moment, I don’t feel like the difficulty levels are consistent enough: sometimes you’ll get a really easy “hard” challenge, and sometimes you’ll get a pretty tricky “easy” one.

Finally, I decided to look at accessibility. Grandma continues to be unsatisfied with me because her son-in-law, who’s partially sighted, always solves the challenges much quicker than I can. She reads the steps out and he does the calculations in his head. With that in mind, I made sure the challenge is usable when you can’t see it. Thanks to modern web standards, that was easy – I set tabindex=1 on the step elements, so that you can navigate between them by pressing tab, and made sure all of the instructions make sense when read out by a screen reader: I had to add an aria-label attribute to the fraction instruction with some alternate text to read out instead of the fancy formatting I use in the visual version. I tested it all with the ChromeVox extension, which works pretty well and is very easy to set up (arguably too easy – it went a bit mad reading every other tab I had open while I was testing).

In the end, this is how the finished game looks:

30secondchallenge

It was a fun excursion, and the game is pretty addictive. You can play it at christianp.github.io/30secondchallenge. Post your average times and record streaks in the comments!

4 Responses to “Take the 30 second arithmetic challenge”

  1. Jeff

    Brilliant! I have thought about making one of those myself, but now I don’t have to, Thank you – I’ll be introducing it to my classes come September.

    On a similar (but simpler) vein, you (or your Grandma) might like the adding up game that I made. A series of numbers flash up on the screen and you have to add them up. Pretty easy when its just 5 numbers form 1 to 5, but gets surprisingly hard (for me at least!) when the numbers to add up can be anything from 1 to 100. You can find the game here: http://www.amathsteacherwrites.co.uk/additup/

    Best wishes

    Jeff

    A Maths Teacher who Writes

    Reply
  2. Sameer

    Very interesting. I am currently learning HTML and Javascript. I am going to fork the repository and try to play around the code myself. Thanks.

    Reply
  3. Josephine

    Does your Grandma happen to be Hazel Perfect by any chance? (If yes, I’m happy to hear that she is still alive and doing math. I love her independent transversal theorem.)

    Reply
    • Christian Perfect

      Hazel Perfect wasn’t my grandma – in fact, I’ve been trying to work out if we’re related. We must be, with this surname! I’m sad to say she died last year – one of her neighbours emailed me to ask if I could take her collection of maths books. I really wished I could, but my house is too small!

      Reply

Leave a Reply

  • (will not be published)

$\LaTeX$: You can use LaTeX in your comments. e.g. $ e^{\pi i} $ for inline maths; \[ e^{\pi i} \] for display-mode (on its own line) maths.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>