Deal or No Deal

  • Deal or No Deal
  • Game
  • Excel
  • School

Do you remember Deal or No Deal?

Deal or No Deal promo shot

It was that TV game show presented by Noel Edmonds with people opening boxes. It's recently come back on ITV. Random chance masquerading as skill - a bit like any time I put in a code change at work.

It ran from 2005 to 2016 in the UK. I was a bit of a fan. In fact, I was a pilgrim on a show in 2011 when they did a set of live shows. They won £250K, confetti cannons went off next to me and I absolutely jumped out of my skin.

I was a nerd not only in the game show sense, but also in the traditional sense. I coded my own game in - of all things - Microsoft Excel.

Deal or No Deal game running in Excel

As insane as it may seem now, it was a genius move back in 2006. I was in Year 9 at school at the time. This was firmly in the era of overzealous web blockers which would catch anything that could vaguely resemble a game. But they can't block Excel can they...

Everyone was playing it - right down to the teachers. It was quick to spin up even on the school computers and was a great way to kill a couple of minutes. We all had a copy stashed away on our memory sticks in case boredom struck.

That's exactly how I rediscovered this gem some 17 years later. I was recycling some old memory sticks and was immediately hit with a wave of nostalgia and poor attempts at pixel art.

I did what every developer wants to do in their free time. I did a code review.

An example of some poor code from a 13 year old me

First off I had to work out how it actually worked. Once I had cracked the super-secret password protection (literally deleting the password check in the file itself) I had a poke around.

Turns out trying to reverse engineer code written in an Excel document nearly 20 years ago is not straightforward. But once I had worked out how to view the hidden columns in an old copy of Office for Mac 2016 the secrets opened right up.

Box value calculation

Thankfully the amount of VBA scripting is minimal. When the game loads up, it generates 22 random numbers that get linked to each box. It then sorts those numbers in ascending order, which then correlate to the values within them. Genius.

G26 holds the state of the game. Offers come in at the fifth box opened, then every third. There's a rather gnarly if function in there checking if the number of boxes opened is not any number where an offer would be made. Literally a repeated list of 16 if functions. Nice one, Matt...

You can click buttons on the sheet to open the boxes. Each time a box is opened, its hidden value is wiped from the main list. Some conditional formatting means the numbers "disappear" by being made the same colour as their background.

That list is also then used to calculate offers. It uses the root mean square of the remaining values to generate an offer. Quite often that means you're getting a really specific offer back like £6,213 but hey at least it's a fair one.

At that point you can Deal and save the number, or No Deal and press your luck. Either way you have no choice but to carry on. Eventually, you get to to the end and you see what's in your box. Literally nothing else happens. You can't even reset it and try again.

Overall it's not pretty but it worked. A miracle for any game written in Excel. It was one of the earliest things I made that I still have hanging around. Frankly it's a miracle it worked at all, let alone still working now.