A Guide to Patterns and Forms in Trainyard
After I became reasonably adept at solving Trainyard puzzles, I discovered the joys of "Expert Mode" and trying to create the shortest or most economical solutions I could. If you haven't seen this yourself yet, when you upload your solution to the site, you can look at all of the other user-submitted solutions to the same puzzle and sort them by speed or economy to see how well you've done.
There are a few simple principles that can be used to optimize your track, although it takes some practice to catch every possible chance to implement them all. The ideas below are focused more towards economy than speed, but the most economical goal is often also the shortest; other times, you'll have to choose one or the other.
1. Get each car to the closest possible goal.
This may seem obvious, but on more complex puzzles, it's easy to get lost trying to make things work when a simpler solution is available. Whenever you start a puzzle, assume that the most straightforward method will work, then eventually delay any cars you need.
2. Get cars onto the same track as quickly as possible, and keep them there as long as possible.
If two or more cars are heading the same way, try putting them onto the same track. The two most common problems with this method are unintended mergers and heading in the wrong direction afterwards; if sharing track causes more problems than it solves, keep the cars separate.
3. Try to re-use squares with curved track passing through them.
This one is easier to understand when you look at the examples below, and it only helps for track economy rather than speed. But curved tracks offer an opportunity to re-use squares without worrying about crossing over other track.
4. Watch for the car that arrives last, and try to get it there quicker.
This tip mostly helps to create the shortest solution, but it will sometimes help you find simpler and more economical solutions as well. If you can make changes that get the last car there before another, repeat ad nauseam.
I've been ignoring my own advice through most of this guide, so here's an example of how to use these ideas, starting with a solution from earlier on. It looked like this:
This solution uses 13+5 track (13 squares total, 5 of which include two tracks) and has a length of 9 steps. The first thing to do is apply rule #3 and re-use one of our curved-track squares:
This reduces the track count to 12+6, since we've re-used a square. (The length is still 9 steps.) Next we can apply rule #2 and re-use part of the Molehill track:
Now the solution is down to 11+7. If we apply rule #4, we can see that the last car to arrive is the red one, and it's delayed by having to go down a row and then back up. A simpler solution arises if we start over completely, applying rules #1 and #2 from the beginning:
Now we're down to just 10+3 track, and we've even reduced the length to 8 steps. The last car to arrive is the green one, and since the yellow car takes the shortest possible path, we won't be able to optimize this solution any further.
I hope you've enjoyed reading this, and I especially hope that it's given you something to think about as you waste hours of your life watching coloured cars zip around on virtual tracks. If you've never played the game and are still, bizarrely, reading this, consider supporting an indie developer and buying Trainyard. And also consider knowing when to stop reading long articles on the internet.