Penrose's Train Challenge

Initializing live version
Download to Desktop

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

For a description of railroad mazes, see the Demonstration "Penrose's Railway Mazes". The train must go from the start (S) to the finish (F). The train can move only in the forward direction, following the curvature of the track. No sharp turns are allowed.


While "Penrose's Railway Mazes" gives you the solutions, it is not interactive; the present Demonstration helps you to find the solution by hand with mouse clicks.

No paper and pencil are necessary: here you can solve the puzzle yourself by clicking the green dots in the right sequence, while the system checks that your train does not make any sharp bends.


Contributed by: Karl Scherer, Antonin Slavik, and Stan Wagon (June 2016)
Open content licensed under CC BY-NC-SA



How to Use this Demonstration

The train starts at the red dot.

You select the next curve (part of the rail track) by clicking close to a green dot. If the move is valid, the train is marked by a new red dot, its previous position is orange, and all other visited dots are yellow.

Text Messages

If you make an illegal move, you get a "not allowed!" message on the graphics screen, and your last click is ignored.

If you reach your destination (marked by a capital "F"), you get a win message.

The System Knows

How does the system know when you made a wrong move?

Every green point has a sequential number. Select "show numbers" to see these numbers.

The system checks whether you made a valid move by finding the triple of the last three point numbers in a database of all allowed triples.


Click "take back" to undo your last step.

Click "save" to store your partially solved path.

Click "restore" to load the stored path.

Click "markers" to switch off the display of the green markers.

If "markers" is selected, you can click "numbers" to see the sequential numbers of the green points.

Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.