12
5
Scenario
I am using pattern matching lockscreen and I sadly forgot my pattern. I would like to know how much time I will need to unlock it. Here are the specifications of Google's lock screen, that we will use for this challenge.
- Every 5 wrong code, the user has to wait
30 seconds
before any further entry. A pattern must, at least, consist in
4 points
(see below)A point can be only used once, but you can go over it several times (see image right below):
Here, the center point is only used once, even if we go over it again for this particular pattern.
Hypothesis & Facts
We'll assume we're superheroes and that we can draw any pattern in 1 second
, we never need to eat or sleep. Yeah, we're superhumans.
I'm a very unlucky person. "Worst case scenario" is my daily life so the pattern I will attempt last will be the right one.
What do we have to pwn?
For those who don't know it, Android (and other phones now) offers the ability of unlocking the phone through drawing a pattern on a 9-point matrix. This matrix can be described as follow :
C(A) M(B) C(C)
M(D) X(E) M(F)
C(G) M(H) C(I)
- C standing for "corner point"
- M for "middle point"
- X for "center point"
- I have given identifiers to the points to make it easier
The permitted direct connections are as follows :
Corner point :
Middle point :
Center point :
However, as pointed out by steveverrill, "once the centre has been used (and therefore becomes unavailable) a direct connection between the bottom left and top right corner becomes unambiguous and therefore possible". Same goes for every "middle point", if e.g. the point B has already been counted, then a direct connection between A and C is possible. If e.g. F has already been counted, then a direct connection between C and I is possible. Etc...
Rules
- The point of this challenge is to return how much time (in human readable form, aka year/day/month/hour/whatever the time you find) I will need to unlock this damn phone.
- You can't hardcode the number of possible valid patterns (don't even Google it, you fool), calculate it (that's actually the fun part, isn't it ?)
- Shortest piece of code wins
- Good luck !
1"You can't hardcode the number of possible valid patterns" is not an observable requirement. – Post Rock Garf Hunter – 2017-06-26T02:36:13.787
What is the maximum pattern length (in moves not points)? Can each connection between two points only be traversed once? – Calvin's Hobbies – 2014-07-27T20:15:09.040
Since there are 9 points, I would say 8 "moves" ;). And since a point can only count once, yes – None – 2014-07-27T20:29:16.913
2I don't have Android, but I'd like to point out that your example appears to violate the permitted direct connections. I'm guessing that once the centre has been used (and therefore becomes unavailable) a direct connection between the bottom left and top right corner becomes unambiguous and therefore possible. – Level River St – 2014-07-27T23:19:51.493
1As a user of this lock screen, I'm almost entirely sure that with enough finger precision, you can connect any two unused points. – Οurous – 2014-07-27T23:44:38.047
4@Ourous: At least on my phone, if you move your finger around a dot to connect dots on either side of it, the dot in between is inserted into the sequence and counted as used anyway. – user2357112 supports Monica – 2014-07-28T05:20:53.813
1@steveverrill : You're right, I added a tip about that. I hope you don't mind I quoted you directly, since I thought it was a good explanation. – None – 2014-07-28T05:41:30.270