Finding a restaurant in a park

[Michael Jackson told me this problem, as a variation of a problem he got from Koen Claessen.]

A park contains paths that intersect at various places. The intersections all have the properties that they are 3-way intersections and that, with one exception, they are indistinguishable from each other. The one exception is an intersection where there is a restaurant. The restaurant is reachable from everywhere in the park. Your task is to find your way to the restaurant.

The park has strict littering regulations, so you are not allowed to modify the paths or intersections (for example, you are not allowed to leave a note an intersection saying you have been there). However, you are allowed to do some bookkeeping on a pad of paper that you bring with you at all times (in the computer-science parlance, you are allowed some state). How can you find the restaurant?

You may assume that once you enter an intersection, you can continue to the left, continue to the right, or return to where you just came from.

[As an alternative puzzle, suppose you must continue through an intersection, turning either left or right, but not turning around to exit the intersection the way you just entered it.]

September 2011

©2020-2023 K.R.M. Leino - Split Template by One Page Love