Introducing a program to produce all valid Ikea Train set configurations

Picture-29-707628

If you’re a parent, you know that kids love them some wooden tracks. I’m serious. Kids could would totally spend hours whining about tracks and then, when they get them, refuse to play with them. That’s why I love Ikea’s wooden train set which costs like $10 and can make a few nice configurations.

But how many configurations can you make? According to this dude you can make nine permutations, shown above. In fact, with four extra curved pieces you could create 130 permutations which is quite a treat.

Here are the instructions for building each version. Amazing stuff.

These instructions contain 15 characters C (clockwise curve), A (anticlockwise curve), S (straight piece) and B (the entire bridge). Here are the building instructions for all the shapes in the picture above:

AAAACCAAAASSAAB
CCCCCCSSAAAAAAB
CAAAAACASSAAAAB
CAAAAASCASAAAAB
CAAAAASSCAAAAAB
AAACAACAAASSAAB
ACAAAASACSAAAAB
ACAAAASSACAAAAB
AACAAASSAACAAAB