Skip to content

Coding as a quick fix

So here’s a situation I’m sure many people will be familiar with, especially if you’ve been on holiday in the UK. You’ve rented a nice cottage or maybe a caravan for a short break. You get settled in, unpack your swimwear to head to the beach and then the torrential downpour begins!

A quick hunt around in cupboards reveals an old board game – something to while away the hours until the rain stops. But guess what? The die is missing!

It’s one of those situations where having the ability to quickly throw together a few lines of code can make light work of such a sticky situation, provided you have a suitable device to hand.

I created this digital die for just such an eventuality. Now I know what you’re going to say: “Why bother? Digital dice are a dime a dozen on your phone’s app store.” Well that’s true, but:

  1. That only works if you can get online – not always that easy if you’re in holiday accommodation in the middle of nowhere, and
  2. Where’s the fun in that? Any excuse to practise your coding skills is a good excuse
A screenshot of The Randomiser, a simple digital die.
The Randomiser – a simple digital die

The app is quick and dirty and hardly spectacular – no fancy visuals and it only simulates a single die – but you can set the range to anything you like, even negative numbers.

You can see the code here. You can try it out here.

Published inProgrammingUtilities

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *