github.com/mmm444/trains

Track generator for IKEA LILLABO and LEGO DUPLO train sets


License
WTFPL
Install
go get github.com/mmm444/trains

Documentation

trains

Track generator for IKEA LILLABO and LEGO DUPLO train sets.

My son got Lego Duplo Deluxe Train Set for Christmas and I was thinking what tracks could be built from the parts in the box. This program finds them all by using a brute force search with some primitive branch pruning.

It was built as faster version of the program presented by John Graham-Cumming in his blog post.

Install

go get -u github.com/mmm444/trains

Run

To generate all the tracks for Lego train set run

trains

and it will output some HTML and SVG to the current directory. On my machine it takes about 20s to find all 2036 tracks.

If you want to genrate all the IKEA LILLABO tracks run

trains -ikea -c 12 -s 2 -b 1

TODO

  • eliminate more symmetrical tracks from the result
  • support switches from the Duplo Train Acccessory Set
  • beautify the code
  • beautify the output