Monday, 16 September 2013

Maidens and Vampires

A recent pub dinner with a friend turned into a rather geeky trading of logic-and-mathematical puzzles.  I have a couple of interesting ones used for interviewing potential undergraduates, and he has some to help make his somewhere-between-primary-and-secondary age pupils think.

One we spent a while discussing was the vampires and maidens problem.  In short, three vampires and three maidens need to travel from one floor to another of a building, using a lift that can carry up to two people.  Some extra constraints: the lift needs someone in it to move (as my friend pointed out, this problem really would be better stated using a boat and two shores, but I guess all those boats are busy moving cabbages and foxes...), and if any maidens are left alone with a greater number of vampires, they get turned into lunch.  Can you come up with a plan to move all six from one floor to another without breaking the rules?

A verbal discussion of the problem very quickly becomes unwieldy, so it wasn't long until my notebook came out and diagrams were drawn.  Based on the diagrams and discussion, there were several interesting observations we managed to make about the puzzle.  The moves going back from the end are a mirror of those from the start (from the start, one or two vampires, or a vampire and a maiden could leave.  To reach the end, one or two vampires, or a vampire and a maiden could arrive).  It also is really important to track where the lift is when drawing pictures, lest you try and teleport a maiden!

Since I've been reading up and thinking a lot about visualising information for clear explanations recently, I thought it'd be fun to try and apply some of that thought to both the problem and solution.  In reality, it's not a very hard problem once you understand it (certainly it doesn't have a hugely branching state space), but I guess for kids it could be used as a good introduction to thinking about enumerating possibilities, of logically structuring thought about a problem, of exploiting symmetries, and drawing insights. Or something.  I also added in the fun challenge of trying to describe this problem through the medium (tedium?) of poetry.





One note, if you Google for this problem you'll find it's usually stated (e.g. in Dara O'Briains School Of Hard Sums) as from the ground floor to the top floor.  For the dual purposes of having the six actors adjacent to the line introducing them, and to make the third line of the poem work, I switched the direction of travel.

Super-high res versions in-case anyone wants to actually turn them into posters (if you do - I'd be interested in knowing if they were useful!  Assume the graphics are licensed CC-By-SA).

Saturday, 14 September 2013

Paranoia

"You're a skinny mother******, ain't ya?"
Well yes, I guess I am, I thought.  Though right now that's probably the last observation I expect you to be making, given the circumstances.  I roll my eyes and simply point at the open door.  My friendly insulter nonchalantly saunters out, heading down the stairs as I close the door behind him.  Across the closed doorway my flatmate and I share a glance of utter disbelief, before he goes to return the rather sharp 6 inch knife in his hand to the kitchen.

It's weird the things that can mess with your head.  You can do, act or think "normally" every day, and then one tiny, incredibly unlikely thing happens, and you suddenly live in fear of something stupid that will never happen again. This results in you taking preventative measures to stop these things happening again, (even though they won't), and it slowly messes up your life, one newly acquired ritual at a time.

I have a vivid memory from my childhood of watching The Really Wild Show, and being informed by Michaela Strachan (who, Wikipedia has terrifyingly let me derive, would have been 27 at the time, which is younger than I am now!) that just thinking about insects crawling up your legs, or wriggling in your hair, or nuzzling into your ear, is enough to make you want to scratch or itch or scrape.  Since that lesson, I've found myself not too worried when I feel like something is wandering around inside my t-shirt.  I'll still scratch the afflicted area, but rationalize it as arm hair being squished against sleeve fabric or leg hairs and jeans rubbing the wrong way.  But I'll feel slightly smug and intelligent at understanding the complicated science of cloth causing thin hairs to press into nerves in my skin, and pleased that I'm not leaping to paranoid imaginings of something malevolent trying to turn me into lunch.

A few weeks ago, a nice summer morning.  My room is a little hot and I'm sleeping these days under a thin sheet as opposed to a full duvet.  A good night's sleep and I'm a little dozy in the morning.  I move, the sheet slips and I feel a little itch on my leg.  Something feels slightly unusual, but I dreamily scratch and it goes away.  A few minutes later and another itch on the other leg.  Another dreamy move of my hand to my leg. Another scratch and

YEOUCH!

The quiet sunny morning is broken by my yell.  The sheet flies off the bed, and a tiny black and yellow dot obliviously buzzes to the window and bumps into the glass.  Again, and again, and again.  I look at my painful thumb, it's (very slightly) swollen. Ow.

And so, eventually, we find ourselves at the first exemplar of my point.  I have been sleeping terribly recently.  Every shift of the sheet, every tickle of my leg hair, every bit of skin that changes temperature in the breeze from the window.  Every single thing that before would have been a simple scratch is now a battle not to turn on the light, strip the bed and re-assure myself there is no wasp out to eat me.  My smug knowledge that there is no insect has been gone, replaced with the overblown memory of that one time I went to itch and got (very mildly) stung in return.

At this point you might be wondering what my moaning about insects has to do with the me being insulted by a stoned guy at 2am.  Well that night also left me with a different irrational fear.  That of scaffolding.  Or, more precisely, scaffolding erected near to somewhere I'm living.  Like the wasp sting, it only takes one slumber to be broken by the sound of your flatmate rummaging through the knife draw in the kitchen to find something to use in self defence, followed by shouts of "who are you?" "what do you want?" out the French windows to an incoherent and rather smelly mass that found its way onto the balcony, for you to become scared of something.  And my mind decided to lock onto the tubular and wooden tower that had (most likely) given the guy access to our third floor exterior.

Back in the present, next door are having some work done, and a scaffolding tower has gone up very close to my window.  Those sleepless nights worrying about whether there are monsters in the bed have been made worse by constant worrying day and night about whether monsters will climb the tower and break in through the skylight.  To allay the panic, I make sure that I have closed all the windows before leaving (because, obviously, locked windows are like force-fields that will keep you safe).  Of course I don't really factor in that it's been a heatwave here recently, and I'm on the top floor, so it will be hot and sticky when I return, which makes it more likely for me to itch and think I'm being attacked by a wasp...

So what can you do?  Force yourself to remember that for over ten thousand sleeps you've only ever been awoken by a wasp once?  Take a deep breath, count to ten and decide that this time it is ok to go out with the window locked open instead of locked closed?  Take to the internet and inflict a thousand words of frustration on whichever kind souls are still reading this?  Or perhaps accept that things will rattle you sometimes, and you know what, that's ok.  Rituals fade and change over time, and as long as you can see them come and go without obsessing too much about them, then you'll be fine.  At least, that's what I tell myself.  Now if you'll excuse me, I need to roll up my jeans as it feels like something is crawling up my leg...

Monday, 12 August 2013

Challenges

Carcassone.  I play a lot of this at the moment.
This particular game has gained a wayward pig.
Games, competitions, challenges and races.  There are many reasons to take part in such activities, but "to win" (to outperform the other entrants) really isn't a good one.  That's not to say that winning an event is without its upsides -- I still smile when walking past a framed certificate at work that heralds a win at a team challenge day in 2004, the prize that day was my first IBM laptop -- but what happens when taking part, the people you meet, the experience you gain and the stories you can and will tell again and again are much more crucial.  Sure, I'll try my hardest to win at a friendly game of Carcassone, but I'll also enjoy the opportunity to catch up with my friends, and have a laugh at each of our fortunes with the little cardboard tiles.

Some challenges are bigger than others.  A game of Carcassone can last up to a few hours (sometimes as long as "gone midnight"), but recently I've found myself involved in a couple of much larger events, and having a lot of fun with them.

This artist's impression of sunrise over Jack & Jill,
as this artist's camera phone is rubbish in low light!
First up was the Oxfam TrailWalker a few weeks ago.  A friend decided to form a team ("Gimme Shelter"), and look for team-mates.  The idea of walking 100km in 30 hours really didn't appeal to me, but being part of the support crew sounded like a lot of fun.  Staying up all night, reading driving instructions to our driver, making hot chocolate and finding the one tube of Deep Heat lost down the back seat of the car for the walkers - count me in!

Here the point was absolutely not to win, it was a team effort and every checkpoint reached was an impressive feat.  Having said that, the the team did amazingly well (they completed it!).  Acting as support was of course a lot less challenging than walking  but I still got a lot out of the overnight experience.  If nothing else, it is very rare that I get to watch the sun set, stay up all night talking and drawing and pouring drinks, and then see the sun rise again.  I even got to have a nap on a sunny morning on the south downs.


Early morning at Jack & Jill

Mini jelly-babies make good, if not somewhat
temporary morale boosting team mates!
The second event is one that has become a bit of a ritual for me.  Days get booked off work for it, and preparatory shopping takes place to ensure I have enough pot noodles, breakfast bars, and Haribo to sustain me for 72 hours.  It is, of course, a programming competition.  The Programming Contest of The International Conference On Functional Programming.

The challenge problems set are always deeply interesting (this year's can be found at http://icfpc2013.cloudapp.net/), and I find it really refreshing to fully engross myself in a problem for a fixed set of time, knowing that (for those days at least) the rest of the world can be on hold.

What's even better though is that at the end of the competition, I have something I can look back on.  My friends and I still discuss previous competitions, what we did, what we could have done differently, laughing about the horrible hacks and stupid tools we wrote in a frenzy to help increase our score.  We do try to do well (and usually don't completely embarrass ourselves), but we know we'll never win, and that's OK.  The clichéd taking part isn't what counts, but that you come away knowing more about yourself, with more experience to draw on, fun memories to keep, and hopefully interesting stories to tell.

One of my ICFP Competition traditions is to make some overblown complicated visualiser for the task.
Usually using some gratuitous and highly dubious technology choices.  This was the year of websockets!

Saturday, 27 July 2013

Hayle Beach and Tate St Ives



Summer, and a heatwave has hit the UK.  Taking full advantage I took a short holiday in Hayle, Cornwall, which has a glorious beach.  Five days of listening to the tide come and go, watching the sun set, and leaving only footprints in the sand is a great way to escape from the noise of London and just switch off and reset.  Then, by night, I had Haven's entertainment offerings to provide hours of quizzes, Spice Girl tributes, drinks and silly dancing.  What more could you possibly want?    
Moss, White, Red and Black 1949
(not at the Tate, but an illustrative example)
http://onmondrian.blogspot.co.uk/2013/06/more-marlow-moss.html
Where I was staying was a few minutes away from St Ives by train, and I spent a day there looking around. Particularly interesting was the Tate gallery, especially an exhibition of the works of Marlow Moss.

Her works were varied and striking.  She had links to Mondrian (rumours abound that she influenced him with parallel black lines), and several of her abstract canvases of white, with black lines and red, yellow or blue colour squares were on display.  A particular favourite was her Composition in Red, Black and White - (if I could find a print of it I'd buy it, but no such luck).  Having never really paid much real attention to art, Neo-plasticism and Mondrian like works were only really on my radar from a particularly good episode of Hustle, however I am now starting to see the appeal.

But you could see her work evolve.  Later the black lines were replaced with raised solid white blocks, and the colour rectangles were painted in the wells.  Black was replaced with shadow, to create a different set of effects.  And then even later the abstract blocks and colour were gone, replaced by everyday objects (like strings or rope) stuck to a white canvas and painted white to match.  Akin to my paper city from a while ago, the interest was in the change of shade and tone.  Other works more physical works of sculpture also provided distraction, mechanical constructions that look like they were designed to rotate but are in-fact fixed, and granite and gunmetal juxtapositions.

Afterwards the cafe there also did some very nice Smoked Salmon sandwiches, before returning to the beach.



Sunday, 7 July 2013

Emotional Games

Mostly recovered from surgery now, however the recovery time included a nice few days of video-game bliss.  I managed to polish off Naughty Dog's 'The Last Of Us' in a couple of days, and then spent the potted hours during the rest of the week ploughing through That Game Company's 'Flow' and 'Journey'.

The Last Of Us

For those that missed it, The Last Of Us is set in a post-apocalyptic america (yay zombies), where veteran survivor and smuggler Joel ends up having to escort a fourteen year old girl, Ellie,  to a group of freedom fighters called the Fireflies.  The game really is about the relationship between Joel and Ellie that develops across this journey, mixed in with stealth, action and adventure and tied up with a crafting and experience system based bow.

Well 'game' is probably a bit strong, as that conjures up connotations of it being fun, which it really isn't.  Compelling story, yes.  At times rewarding game-play, sure.  Stupidly frustrating at times?  Yup.  Fun? Never quite gets there.  It's probably more enjoyable to watch someone else play the game than it is to play it.  At least then the movie-like story and action don't get interfered with by your inability to not get your neck chewed on by blind mute cauliflower headed dead people.

However don't let this put you off, it really, really is compelling.  The game has a way of drawing you in and switching things up.  (Minor spoilers ahead)... About three quarters of the way through the game, major emotional stuff had gone down, we had a horse and were armed with a flame-thrower.  It felt close to the end, I thought the final goal was in sight, and, like my characters, I just wanted to get there.  I wanted the adventure to reach its resolution.  And so, for five minutes, I stopped being diligent, fully searching every corner of every building for desperately needed supplies and ploughed forward, aching to reach the door that was obviously round the next corner, with final cut-scene, and credits.

Except the door didn't come, and instead a load of stupidly difficult hunters did.  And I was out of resources, stuck with a now painfully tense fight, and (silently) cursing myself for daring to dream that end was near.  Luckily I had several more hours of game-play to not make that mistake again!

The interesting thing about TLOU is that while the game-play made you feel tense, or excited (or when you repeatedly become dinner, really really frustrated), the major driving force (the bond between Joel & Ellie), and the emotional heartstrings it tried to pull, were almost exclusively developed by the story, told through cut-scenes and action sequences.  Engagement and empathy being two sides of a coin that were never quite allowed to meet in the game.

Journey

That Game Company's Journey on the other hand was a short (about three hours for a play-though) marvel. Everything about the game is designed to engage you the player with your avatar, and make you really feel their world.  You start a lonely figure lost in a desert of graves, with a mountain in the distance.  As you progress to the mountain you get lost in a sea of sand-dunes, slide into a forgotten city, and eventually claw your way back up to the peak.  An interesting quirk is that as you explore you meet others, silent avatars controlled by other players, your companions, who may help (but can't really hinder), but that make your adventure less lonely.

There are language-neutral murals that tell the story of the game, which are really telling the story of your journey - what has been, and what is to come.  And the foreshadowing towards the end is poignant.  (Minor spoiler ahoy) I cannot overstate how much it hit me when I found myself on the mountainside, three foot in snow.  My companion had been lost to a beast, and I suddenly realised how utterly alone I was. Slowing down, being broken by the blizzard, my avatar finally crumpled into the cold white blanket, and I genuinely gave up hope.

I guess the difference is that the Last Of Us offered an adventure, Journey offered an experience.

Sunday, 30 June 2013

Lost Voices

Mine
(the squeamish might want to avoid this half of the post)

I was thinking of this room the entire time. 
So, this week I did something I've never done before.  I underwent surgery.  Having never really gone through the process of being cut up by the NHS, I thought things would be a lot more complex than they actually were - turn up at a set time, throw some details at a computer and go find a waiting room.  Then a person calls your name, you go into another waiting room, then another person calls your name, and you finally go into a small room with a chair and who I assumed were two friendly looking medical types, are ushered into said chair and talked at for a few minutes.  A consent form is signed, and then the surgeon asks "Have you got any questions?".  "Is this real?" I muttered inaudibly, as the transition from watching Judge Judy on TV while waiting, to being in a room reminiscent to one from the opening of Half Life Two had caught me slightly off guard.  What I should have asked is: "What are your names?", as I'm pretty sure  the two strangers who proceeded to operate never really identified themselves. 

The procedure itself was nothing major or serious, but it did involve three injections of a local anaesthetic.  I'm sitting there, with one half of my tongue being held in place by the assistant, and a big needle coming towards the other side, and the surgeon suggests "you can close your eyes, if you want".  I opted to stare at the massive needle that inflicted an almost disappointingly small amount of pain.

A few minutes later the inability to feel anything kicks in, and then everything becomes a bit routine.
I just sit there and watch, detached, as tongue holding, scalpel cutting, blood flowing,  gauze soaking and four stitches (the surgeon seemed to be enjoying his needlecraft a little too much) all floated past.

Ten minutes later, everything was finished, and I walked out fine.  Done. Nothing to worry about.  May as well go into work.  An hour later, on a bus five minutes away from work, the anaesthetic wore off.

Ow.

Now, if I'd thought for a second about what had happened in the hospital, it was obvious that it was going to hurt...
I'm now recovering at my parents.  They live near a field.
Needless to say, I've since spent quite a while living with a very sensitive, slowly shrinking, golf-ball in my mouth.  This has meant no talking, no solid foods, and some rather interesting shopping receipts.
In retrospect, I should have bought soup, lots of soup.
Leah
A while ago I started watching The Voice UK, Season 2.  It finished last week, and the obvious winner didn't win!  This is probably more a statement of the kind of person likely to phone in to vote for a TV singing competition than it is about any level of talent.  Regardless, I am somewhat irritated by this obvious miscarriage of justice, and am therefore resolved to never watch another season of The Voice UK again.

Having said that, since The Voice has ended I have been watching quite a few of Leah's performance videos on YouTube.  One striking thing about her videos is the rather high number of views that they have, and watching the numbers change between my ridiculous number of repeat plays of "I Will Survive" showed what I was doing was insignificant compared to the rest of the internet.  One wonders if these is the same for all of the show's finalists.

So, for a bit of fun, during a (quite literally thanks to my oral incapacitation) quiet afternoon I decided to spend some time messing about and looking into this.  A nice excuse to do some programming with a couple of web technologies that I'd been meaning to play with.

So, below is a screenshot (click to go to the real thing) of what I came up with.  For each of the four artists, you have their performances (roughly in order), and the number of views on their respective YouTube videos as of 12:00 today.    

Click to see the web-version
My conclusion: people who watch YouTube videos don't like making phone calls.