Nov 152015
 

I’ve pretty good at quite a lot of things, but I’ve always been a bit embarrassed about not being able to speak a second language. A couple of GCSEs in French and German was as far as I got, and that’s now mostly faded. This famously isn’t rare for English speakers, but after years of concentrating on science and maths I quite fancied branching out and giving a language a go.

At least I had the luxury of not needing to learn something ‘useful’, given that most international workplaces speak English, so there was the freedom to pick anything that appealed (and wanting to learn is vital if you want to make progress in any field). I knew the most French, but I’m just not that big on the Latin languages. I love Iceland and would love to speak Icelandic, but it’s quite difficult and just a bit too niche. So then I considered the other Nordic languages, and decided on Norwegian.

Apparently Norwegian is one of the easiest languages for an English speaker to learn. It’s relatively simple, there aren’t many strange sounds, and the grammar is familiar. It’s also considered the ‘middle’ language between Swedish and Danish – Danish has very similar vocabulary but different pronunciation (hence with Norwegian you get reading in Danish ‘for free’), and Swedish has similar pronunciation but more variation in vocabulary. The result being that Norwegian speakers have a reasonable chance of being able to communicate with both Swedes and Danes. That sounded promising, and the sound and look of the language appealed, so I thought I’d give it a go.

Naturally I assumed that technology had revolutionised language learning as it has everything else, and it appears I wasn’t wrong. There are loads of sites and apps available, and the most popular were Babbel.com and Duolingo.com. At the time (October 2014) Duolingo didn’t offer a Norwegian course, so I dived in with Babbel. But recently I’ve given been using Duolingo as well, so I’ll start with that.

DuolingoLogo

Duolingo is a free service offering 15 languages at last count, with more on the way. It’s a modern approach to language teaching, with all content crowd-sourced from volunteers and a healthy dose of gamification thrown in.

Gamification is all about using the compulsive reward structure of games to keep you interested. Finishing a lesson in Duolingo gets you XP, and gaining XP levels you up (I don’t know what levels do). You choose an XP target per day and build up streaks, and completing courses and streaks earns you Lingots, which you can spend in the store on… stuff to help you earn more Lingots (OK, I don’t really know what they’re for either). It’s an interesting approach, and probably useful if you’re not that fussed about learning, but I suspect that if you need gimmicks to progress then maybe you’ve not got the motivation required to get very far.

Each lesson introduces a few new words, and you can click on a word at any time to get a translation. Lessons consist of a random series of translation or listening exercises, and last until you get enough answers correct. There’s a robot voice for reading out words and sentence, and for the most part it’s decent but does sound very synthetic. There are no formal lessons on grammar, but the website (only, not the app) often has a page of explanation with each topic explaining a few intricacies.

Because each lesson only uses words you already know, plus a few new ones, the content tends to be repetitive and bears little resemblance to actual speech. The repetition is a good thing for learning, but it all feels rather contrived and likely to give the illusion that you know more than you do. I’ve come across a few questionable sentence choices as well, my favourite being “The wolf is eating me”. I suppose that could come in useful one day.

Overall though Duolingo does a good job. As it’s free you’ve got nothing to lose, so it’s worth giving it a go.

BabbelLogo

Babbel is different in that it’s a paid subscription service, again offering lessons both on the site and in an app. What you’re paying for with Babbel is proper structured lessons and real voice actors, both of which I find hugely valuable.

There are two main types of content for each language – structured courses of lessons and vocabulary lists. The structured lessons remind me of traditional language courses, starting with basic phrases (hello, goodbye, how are you, I don’t understand, etc), then introducing more grammar rules and tenses alongside topics such as food and drink, families, hobbies and the like.

There’s the usual variety of activities in each lesson, from repeating words with speech recognition, matching words to their translation, anagrams, and filling in missing gaps in sentences (from both text and audio cues). The speech recognition is a bit hit and miss, so I tend to turn it off, but that could just be my pronunciation…

Unlike Duolingo, sentences feel a lot more natural. You’re only learning a few new words each lesson, but they’re used in context with a lot of unfamiliar words (with the full English translation provided). You pick up quite a lot of random extra words and phrases this way, as you’re more exposed to the full language. Finding yourself understanding more and more of this ‘padding’ is a rewarding sign of progress.

My favourite bits early on were the dialogues at the end of each lesson. Some of them actually made me laugh out loud (not sure if the comedy was intentional or not), from someone complaining over the price of vegetables, to an interview for a plumbing job where she’d previously worked as a doctor, in telemarketing and as a gardener in a cemetery. They remind me of the GCSE language writing exams, where as long as it was grammatically correct you could write all manner of rubbish. I remember giggling away to myself while writing about a school skiing trip where three people broke their legs, the teachers were in the bar all day and everyone had to go home early with diarrhoea (“durchfall”, the word that every student of German knows).

Finally there’s your vocabulary list. Each new word and phrase goes into your list, and different words come up for revision every day. Getting it right moves it up a level so it comes up for revision less often, while getting it wrong shows it again sooner. It’s intuitive, helpful, and gives you something quick to do each day – five or ten minutes here and there will usually get you through your list (Duolingo has something similar, but the logic is a bit fuzzier).

Overall I’m very impressed with both sites. I’ve learnt more in the last year that I did with years of lessons at school. Whether that’s through the approach or just wanting to learn I don’t know, but I suspect a bit of both. Personally I prefer Babbel, and I think it’s very good value at around £40/year (they often send special offers after signing up). If you feel like giving it a go, here’s an invite with a free week. But I’ll continue to use Duolingo alongside it, as they complement each other well.

Apr 182014
 

I recently dug up my university dissertation and related code, and was surprised that it still runs and isn’t as bad as I feared. It was pretty interesting at the time so I thought I’d share. It was a good call to choose a project in the games/puzzle area, as I’m pretty sure that helped me get my job in the games industry a few months later!

Full report, and running the code

RollingBlock.pdf – this is the full dissertation I submitted, in case you’re interested in reading about this in more depth.

RollingBlock.zip – this is the full source and compiled code, written in Java. I’ve not recompiled it since 2002 and some of the formatting seems a bit messed up, but it still runs (please don’t judge the code quality, this was my first reasonable sized coding project!). There is the full editor program, plus a variant on the player for puzzles with multiple moveable blocks.

To run the Editor program you need the Java JRE installed. If java.exe is in your path then editor.bat should launch the program, otherwise you’ll need to put the full path in.

Rolling Block Puzzles

The idea of the ‘rolling block’ puzzle is to roll a non-cube block (2×1 in the simplest case) through a grid-based maze so it ends up exactly covering the goal. Because the block isn’t square it takes up more room in some orientations that others, and the puzzle involves shuffling the block into the right orientation to get to where you want to go.

Here is an example puzzle, where you need to roll the blue block so that it stands upright on the yellow goal square. So the only possible first move is up-left, because there isn’t enough room to roll in the other directions:

Example of a rolling block puzzleThis is a type of multi-state, or concealed path, maze. Underneath you’re navigating a state graph of moves from the start point to the end point, but the shape of the block, and the moves it allows, means that the actual path to the solution can’t easily be seen. There are only 53 empty squares on the grid but there are 125 reachable maze states, and the shortest solution requires 32 moves (solution at the bottom).

Automatic maze generation

These types of puzzles are very hard to design unassisted, because each block added or removed impacts the state graph in many different places. Some clever people design these things by hand, but us mere mortals can use a computer.

The first thing we need is a solver. This does an exhaustive breadth-first search of the maze and builds a graph of all states and the transitions between them. In each state there are at most four legal moves so it checks if each destination state is a duplicate, add a new node if it isn’t, and add an edge between the two nodes. Here is a very small 5×5 maze:

rb5x5And this is the state graph a solver will come up with:

rb5x5graph

The numbers are how many moves are required to reach each state, so zero is the start position and 18 is the goal position (the colour coding is based on branches and dead ends). So you can see that even a tiny 5×5 maze with three obstacle blocks has quite a complex state graph.

Measuring puzzle quality

To generate good new puzzles, we have to be able to tell the difference between a good puzzle and a bad one. What makes a puzzle ‘good’ is a hard thing to pin down, but we can pull out a few ideas such as it having a long solution, many dead ends, looking deceptively simple etc. For our purposes though we need to come up with a single score for the quality of a given puzzle, such that a higher score means the layout is ‘better’ in some sense.

One approach is to analyse the graph that the solver produced, and score it using a weighted set of criteria. The criteria I used are:

  • Number of nodes – more states means a more complex puzzle
  • Solution length – longer puzzles tend to be harder
  • Number of branches – choices and dead ends are what make the puzzle interesting
  • Number of blocks – give this a negative weight to prefer simpler looking puzzles with less obstacles
  • Number of turns – requiring more direction changes can be a more interesting solution
  • Average loop length – large loops in the graph make it less obvious when you’re on the right path

Different weights can be assigned here depending on what characteristics you want in your generated puzzle.

rb_8x8C

A more interesting block – 60 move solution

Genetic algorithms

So now we can give a score to a specific puzzle, but we need to use this to come up with the best puzzle possible. For this we can use a type of genetic algorithm.

Genetic algorithms are based on the same principles as evolution in the real world: using randomness to slowly evolve towards an optimal solution. The idea is to start with a solution (any solution), and then randomly modify it a bit. If the new solution is better than the old one, keep it, otherwise throw it away. Repeat this process many times, each time starting with the best solution you’ve found so far. To tell if a solution is better than the previous one we apply a fitness function to see if it survives to pass on its ‘genes’ (or instead gets eaten by bears). After a while, you can stop the process and take the best solution found so far as your result. Despite what creationists may tell you, order can result from randomness (plus a fitness function).

In the case of a rolling block puzzle we start with either an empty board, or one with a few random blocks, and a mutation rate (maybe 5%). Each iteration we check every grid square to see if it ‘mutates’ (toggles between obstacle and empty). The fitness function is the puzzle score described earlier. If the score is higher or equal we keep it. Then just keep going as long as you want.

And that’s pretty much all you need to generate new puzzles. The key is the fitness function – the better it fits our subjective opinion of “this is a good puzzle”, the better the generated results will be. I’m sure that there are much better fitness functions out there but this one works well enough.

Here’s a video of it in action.

References

Robert Abbott’s Logic Mazes page

My multi-level puzzle applet hosted on Logic Mazes (probably won’t run with today’s security settings)

Erich Friedman’s designs

A bunch of mobile games using a similar puzzle

 

Example solution (L is up-left): LURDRDRDDDLLLULDRRRRULDLLLUUULUU

Jan 122014
 

Massive Open Online Courses (MOOCs) have really taken off in the last couple of years. I was aware they existed but it was only a few months ago that I took the plunge and signed up for one. I wasn’t really sure what to expect in terms of course content, time requirements and difficulty, so I thought I’d talk about the two I’ve taken so far.

A couple of friends had taken courses on Coursera so that’s where I signed up (although there are many other options). Coursera hosts courses run by many different universities around the world, on all manner of subjects. There are loads of courses starting throughout January so now is a good time to see if anything takes your fancy. Most run for between four and 12 weeks, and generally ask for 4-8 hours per week to watch the lectures and complete the homework (although this is quite variable depending on how easy you find the subject).

The courses aren’t ‘worth’ anything in the sense of traditional qualifications. An interesting development is that some of the more rigorous Coursera courses have a ‘Signature Track’ option where you can pay some money to have your identity verified and get some real university credit for your work. I’ve not looked too much into this though.

So why did I want to do a course in the first place? I’ve read quite a few popular science books on physics, quantum mechanic, string theory and the like but they always shy away from the actual maths (understandable if you want to sell any copies). Without the maths though it’s impossible to understand the subject beyond some vague hand wavy concepts. I was looking for some way to delve a little deeper into the subject without doing a full physics degree, which is rather impractical when you have a job.

From the Big Bang to Dark Energy

The first course that caught my eye was From the Big Bang to Dark Energy. It’s a short four week course from the University of Tokyo giving an overview of the history of the universe and basic particle physics. The only recommended background knowledge was some simple high school maths, so I wasn’t expecting anything too difficult.

There were a couple of hours of lectures per week which were engaging and easy to understand. They concentrated on general concepts rather than equations (although there were a few equations scattered around), in particular focusing on why we know what we know from a range of recent experiments.

This course was aimed at the more casual learner. It was very light on the maths in the lecture videos, but used the homework questions to introduce a few calculations (mostly just cancelling units and multiplying a few numbers). You could quite happily ignore the maths and still get a pass, and you were allowed nearly unlimited attempts at the questions (hence my final score of 100%).

While a lot of the content was familiar to me I still learnt a few things, and I would recommend this course to anyone looking for a light introduction to the history and evolution of the universe (assuming the course runs again).

Analysis of a Complex Kind

The second course I took was Analysis of a Complex Kind on complex numbers and complex analysis, from Wesleyan University. This was a completely different experience. It was much more formal and rigorous, and felt a lot like a traditional university-level class. I spend probably 6-9 hours per week, which was sometimes a struggle. Even though the course was only six weeks long it felt like quite a commitment (although that may just be a comment on my general level of busyness).

I wasn’t overly familiar with complex analysis before the course outside of a few bits at school and university, but elements of it keep cropping up in my reading so I decided it would be interesting to learn more. You definitely need a strong interest and ability in maths before considering this course, and if you’re going into complex numbers cold then it’ll be a steep learning curve.

It made a change to go back to working with pen and paper, and I got through reams of the stuff by the end. Picking up a pen is something I rarely find myself needing to do these days. The assessments were mainly multiple choice questions, but there’s a deceptively large amount of work needed to find the answers.

One new feature for me in this course was peer-assessed assignments. These were questions that involved drawing graphs, or long-form answers that couldn’t be multiple choice. You can either scan in your work on paper or submit PDFs created directly on computer, and then you’re provided marking guidelines and have a week to assess four other people’s work. The process isn’t perfect (I saw one or two marking errors) but that’s why everyone is marked four times and averaged. Doing a decent job of marking others’ work actually took a fair chunk of time, longer than I was expecting.

I was pleased with my final score of 94.8% (fractionally missing out on a distinction). It was a good workout for the brain, and even though I’m unlikely to use anything I learnt in this course day to day I suspect it’ll come in handy should I pursue any further maths or physics-based education.

 Overall

These type of courses work really well if you can reliably dedicate a few hours per week. I won’t be taking any more for at least a couple of months as they monopolised my free time somewhat (and I have other projects I want to work on), but I’m sure I’ll be back for more.

A lot of the courses seem to be being run for the first time by people who haven’t done this kind of thing before, but don’t let that put you off. These two were both well run and offered great learning potential. MOOCs are likely to only improve in the future as people get more used to what works and what doesn’t. Find something you’re interested in and give one a go!