It all started off with a simple sliding block puzzle my daughter found in a Christmas cracker!

Creating a Scratch version of this was easy enough…

All you need to do is click on the numbered square you want to shift into the adjacent empty space. By doing this correctly, you should be able to re-arrange the numbers so that they are in the correct, ascending order, with the space in the bottom right-hand corner.

Learn more about this project

So, I uploaded that one to share on the Scratch website. Feel free to take a look at the source code there – essentially, there’s a list with 9 values in it. Swapping the position of the 9 value with the position of one of the values whose sprite is adjacent to its current location gives the impression of movement (because the sprite for 9 is hidden). So, all I needed was 9 copies of the same sprite with 9 costumes and a bit of code for each sprite so that only if a move was possible would you be able to swap the blank 9 square with the one you clicked on. As the data was stored in a list, checking to see if the puzzle had been solved was extremely simple.

The most challenging part was the set of rules for jumbling up the puzzle at the start. Just assigning random values for each item on the list would result in possibly ending up with an unsolvable puzzle – so I chose to replicate a series of random moves. The big question is: how many moves do you need in order to get a well-shuffled puzzle? To me that’s the sort of question you could set as a topic for investigation in Google’s new Science Fair – but then, that’s the sort of thing I’d be expected to say, as a lapsed mathematician…

Then, it occurred to me, since I’d designed it so that the appearance of the sprites was independent of the values in the list, I could replace each sprite costume with anything I wanted. Originally, I’d been thinking of splitting up a picture into 9 squares, but – why not put in different number sequences?

So, then I had some fun modifying the sprites to do different variations:

This one takes a chunk out of a multiplication square – hence the numbers above and to the left of the grid.

This one is much simpler – just put the numbers in ascending order. Unfortunately, I can’t think of a simple way of making this random – apart from preparing a series of different sets of numbers.

Now this one has a visual clue added to ensure that the numbers from each set are listed in ascending order.

I could have made this one more interesting by choosing sets of numbers so that the same numerical value appeared more than once, but in a different position in the ascending order for each set. Perhaps I’ll add a couple of examples of this later.

Slightly harder numbers to work with. Now, the next thing I could do would be to make a series of puzzles of increasing difficulty with the ScratchCat at the end giving you the passcode to start the next puzzle in the sequence. That would be easy enough to do – I could embed each puzzle on its own web page with a link to the next puzzle under each one (or a grid of links to puzzles below, with a message like – “the passcode to puzzle 1134 is SQUIRREL” given by the ScratchCat when you complete each one.

Otherwise, I could always compile each Scratch game to an exe file.

What I do will probably depend on what feedback I get…

Another visual clue – again, I could have made this more frustrating by having the same numeric values in different positions on each line.

And ordering decimal numbers. Now, I’m wondering if the visual clue makes this puzzle easier or harder. My guess would be easier, as you can just concentrate on getting the pattern right, rather than the numbers. Again, this is the sort of thing you could investigate – create three equivalent puzzles one with checkerboard colouring, one with gradient colouring and one with monochromatic backgrounds. Set them to different groups of students and rate their perceived difficulty.

Anyone interested in investigating this?

Of course, I’m not finished yet – I could do fractions, I could have rows of equivalent fractions with increasing sizes of denominators. I could…

Of course, some people think I’ve ruined a fun puzzle by turning it into mathematical torture…