Run, Run, Rudolph!

I am currently lying in bed, wrapped in a very fluffy dressing gown, under no fewer than three blankets, one of which is a microfibre fleece, shivering.  I ache in places I didn't even know I had.  I have consumed so much Lemsip I have developed a liking for the taste (for my American readers, apparently it's a bit like Theraflu).  But I am not downhearted, oh no, because today I get to share one of my favourite things I have ever done in a classroom... and it'll make you money at your winter fair!

Bitmoji Image

TL:DR
Go to bit.ly/reindeerrush     Project the screen     
Charge 20p to place a bet        Award the winner with sweets!

Some context...
A while ago I was told that I had to produce something for the Christmas fair at school.  I was the ICT/Computing lead teacher, so I thought I would do something techie.  I also taught the oldest children in the school, so I didn't want to take too much time off-timetable because we had deadlines and assessments; you know how it is.  

We had begun to look at coding using Scratch - a web-based drag-and-drop programme builder made by the folks at MIT.  It's child-friendly, fairly foolproof and, most importantly, free!  So I thought I could let the children have a play around and challenged them to write a programme that caused a character to walk across the screen and tell a joke.  Fairly simple stuff, but it would keep them entertained.

Children being what they are, they began to experiment with their code.  There's not much you can do with a character walking expect increase or decrease the speed. So they did that.  And that's what gave me the idea.

Carnival Games
There was an old carnival game called The Kentucky Derby (it changed its name to The Arabian Derby for reasons I cannot fathom).  It was fairly simple.  You rolled balls on a skeeball table and the number of points you got advanced a mechanical horse (or camel later on) by that many places.  The winner was the horse who reached the finish line first.  


This thing was as lucrative as it was addictive.  The prizes were nothing special, you could accumulate several smaller prizes for a larger prize, but the number of players per round more than paid for the merchandise.  It was a guaranteed money-spinner.  And it wasn't a million miles away from what the children had created...

A Chorus Line
I pitched the idea to the class and they loved it.  We would be the first class in the history of the school to have a digital entry in the Christmas fair.  It would require minimal set-up on the day and almost no take-down afterwards (the children had to help with tidying their stall away, so this was a big selling point!).  

So we had our BIG PROJECT: A racing game where people could place bets on a sprite.
Now we had to ABSTRACT the problem.  This was very useful because abstraction was quite a new concept, not only for the children but for a lot of the staff as well.  Abstraction was taking out BIG PROJECT and breaking it down into lots of little projects.  The children were quite surprised at how much work we had to do.

We needed:
  • Racers
  • Code to make the racers move
  • A 'win' screen for each racer (because any one of them could win)
  • A background for them to race on
Since it was a Christmas fair, we decided that we would have Santa's reindeer race.  I was surprised that they only knew Rudolph.  Not a problem, the next day, during our English lesson, we studied A Visit from St. Nicholas by Clement Clarke Moore.  

"Mr M!"  came the excited cries, "The reindeer names!"

It was almost like I'd planned it...

So we had 9 racers.  Dasher, Dancer, Donder, Blitzen, Comet, Cupid, Prancer, Vixen and Rudolph.  Except we could only fit 6 on the screen comfortably, so we had to cut a few.  Then we hit our first stumbling block.  

The home screen.  We matched the names to the noses.  

Drawing Reindeer is hard!
Everybody tried.  Some were quite good... but transferring the drawn image onto the computer proved too difficult for the children (I wanted them to independently do as much of it as they could).  This was in the days before reliable touchscreen and styluses, so it would have involved drawing on paper, scanning the picture, creating a transparent background in photoshop... too much.  So I set the reindeer team the task of working the problem.

They came back with clipart prancing reindeer.  Perfect... almost.

The problem was that when we applied the movement code to our new sprites, they just glided across the screen.  They didn't look like they were running at all.  We needed some animation to bring them to life.

A group of children requested the project for the weekend so I let them have it.  They came back to school on Monday with big smiles on their faces.  They had watched YouTube videos on simple animation and realised that all they needed to do was cut the legs off the reindeer and have them switch from facing inward to facing outward.  So that was their task when we next had the laptops.  I moved my attention to the coding team and the problem of fairness and excitement.

And the winner is... Everyone?
To have a race, someone has to win.  Everyone else has to lose.  The coding team were very proud of the code they had written but it had one very big flaw.  They had programmed the races so that each reindeer took turns at winning.  Essentially just an increasing sequence that reset after 9.  

I asked them if they thought this was fair.  They said yes because it meant that everyone had a chance of winning.  Bless them.  I pointed out that their system might be easy to crack and we would only ever have people placing bets on the winning reindeer.  They were horrified when I reminded them that the idea was to make money from the losing bets.  So we had to find a way to ensure that:
  • Everybody could be the winner
  • 8 out of 9 would lose every time
  • Each reindeer was equally likely to win or lose each race
  • Nobody, not even us, could know for certain who would win
I was so happy that one of them said: "It needs to be random!"  Mostly because it meant a maths lesson was called for...

There was a lot of coding involved!

Roll Up, Roll Up...
We had a maths lesson about probability (naughty because it was no longer on the curriculum) and how to ensure that a random number could be picked from a range every time.  Then we transferred this knowledge onto the computer.  

The children wrote a code that told the computer to move each individual reindeer a random number of steps between 0 and 5.  Applying this to each reindeer resulted in our first completely randomised race.  It was very exciting.

It was also very quick.  The race length was about 30 'moves'.  We test-ran several races and because of the 0-5 random chance generator we had created, some of the reindeer were leaping to the finish line in just 6 moves.  It was split-second stuff.  not long enough to generate any excitement.  The animation team were also upset because it didn't leave enough time for their wonderfully dynamic legs to be seen.

Back to the drawing board.

Wait a second...
The children really started to own the project at this point.  They gathered around their table and began to attack the problem.  There was absolutely no hint of defeat in them at all.  They already knew how to tell a sprite to 'wait' because they had used that in their original joke-telling projects.  They decided to add a 'wait' command to their random movement loop.  

This worked well, sort of.  The race was a little bit longer but all the reindeer were moving, then waiting, then moving, then waiting.  It was like a bizarre game of Grandma's Footsteps.  I was about to step in when one of the girls had an epiphany:

"Randomise the wait time!"

So now we had reindeer that would run forwards at a random rate of between 0 and 5 paces, wait for a random length of 0-3 seconds, then run forwards again at another random rate.  It was perfect.  We ran several races and children placed mock bets on the winner and the outcome was random every time.  They had done it.

But it looked awful.

Greens, greens, nothing but greens...
The default screen we had been testing on was a green background.  It was not Christmassy.  Luckily, while the coding team had been busy coding, and the animation team had been busy animating, our digital design team had been creating a background.  They had found a snow-covered field (it had been slightly ploughed so it even looked like lost of races had happened already) and set it as the backdrop.  They had drawn a starting block, which, with the animation team's help, opened and closed for each race.  They had even created magical reindeer food for each of the reindeer to race towards.  This is actually my favourite bit of the whole thing.  They took a picture of dog kibble and worked with the animation team to add magical sparkles to it.  It's a really cute touch.

The winner's enclosure

We put it all together and were very impressed.  The only thing missing was the winner's screen. This was created by using a stock background (Scratch has lots to choose from) and having the winning reindeer's name appear on the screen.  We also decided to add the winning reindeer jumping for joy (by rotating the original animation a quarter turn).  All that was left to do was build in a reset button and launch the game.

A lie that brings a smile...
We set up our 'stall'.  We had the big screen and projected the computer on to it.  It was pretty impressive.  We sold our betting slips to the children and parents and told them... that the reindeer were voice- and motion-activated.  We actually had these kids believing that the louder they shouted, and the more they flapped their arms, the faster their reindeer would move.  It was hilarious.  And loud.  Very loud.

We had a couple of complaints - some parents thought the game was rigged because Vixen kept winning (and she did, five in a row once).  I explained that the game was totally random and built in a stats screen that showed all the races and winners within a session (press the up arrow to see this, and the down arrow to clear it).

We were also shamed for encouraging gambling but I argued that it was no worse than a raffle.  Also, since five out of every six children lost their money, it was a good way to teach that gambling isn't a good way to earn money.  It was nice to see some of the children from my class comforting the losing children, saying things like 'you can't win every time' and 'isn't it good you only lost 20p?'  Meanwhile, I was saying 'you can always try again!'  Because I'm morally bankrupt and wanted to win the prize for raising the most money.

We did, by the way.  Our overheads were negligible - a tub of Haribo that cost a fiver.  After the first five races, we were on pure profit and we could run around 5 races ever minute.  The fair was open for two hours.  We cleaned up.  Figuratively, of course, there was no literal clean up beyond shutting down the computer.  Everybody wins.

A gift that keeps on giving...
I have used the same programme several times and it has always proved popular.  And now I offer it to you.  It can be found at bit.ly/reindeerrush  Just open it up, make it full screen and press the green flag to begin.  The controls are simple enough.  Space begins a race.  N resets the race (N for New).  The up arrow shows the stats; the down arrow hides the stats.  If you press space before pressing N, you have reindeer running all over the winners' screen.  Don't panic.  Just hit N and start again.

Thanks for reading this far.  If you haven't read my other Christmas Fair posts, they're a lot more curriculum-based with lots of ideas of how to create things to sell and incorporate the whole project into your timetable so as not to miss any teaching and learning time, check them out.  

Bitmoji Image
I've recently discovered Bitmoji...

If this is your first time here, you are very welcome.  Do read some of my other posts - the one on marking is very popular (it's here) and please let others know about this blog!  If there is anything you would like me to cover, leave a comment, or send me a tweet,  Me details are below.  If you would like to have me as a guest post on your blog, please get in touch.  I've done this already for a couple of people and I'm always happy to meet new bloggers!

It is nearly the end of the term, the year and the decade!  Do yourself a favour; look back on everything you have achieved.  You are doing a brilliant job in a difficult time.  Keep smiling and help others to keep smiling too.  

Carl Headley-Morris

@Mr_M_Musings     tragiclantern@gmail.com     bit.ly/carlslearningplace