Puzzle: How many unlock paths?

I was recently at dinner with some Linux kernel hackers who were showing off their smartphones. These phones have an interesting unlock mechanism: the phone displays an 3-by-3 array of circles, and the user traces out a path among the circles. If the path is correct, the phone unlocks.

The paths are not arbitrary. From what I could see, here are the rules governing them:

  1. Paths are composed of a series of straight line segments.
  2. Each line segment connects a pair of circles.
  3. If the preceding line segment arrived at a given circle, then the next line segment must leave that same circle.
  4. A given circle may be visited only once.
  5. A line segment may pass over a given circle without visiting it only if that circle has already been visited. (Attempting to pass over a not-yet-visited circle will instead visit that circle.)

How many unique paths are there?

This entry was posted in Uncategorized and tagged . Bookmark the permalink.

3 Responses to Puzzle: How many unlock paths?

  1. paulmckrcu says:

    Thank you for the info

    Should be an easy fix. 😉

  2. paulmckrcu says:

    And in fact…

    All that is required is to initialize “sum” in trynext() to 1 only if the path length is at least 4.

  3. Anonymous says:

    deadlocks

    HTM Lock elision will still make deadlock avoidance easier because you can hopefully get away with more coarse grained locks. The less locks you have the easier deadlock avoidance is.

    A simple implementation may just use a single lock for the whole program as fallback, which by definition has no deadlock potential.

    Of course the devil in the details, as in lock regions that frequently or always abort may still need more locks. But it may be good enough

    Andi Kleen

Comments are closed.