Cracking a sliding-window lock in the fewest presses
How a keypad with no enter key lets every press complete a new code, why overlapping codes is the whole trick, and the strategies that keep you from painting yourself into a corner.

A lock that never stops watching
Most locks ask you to type a code and press enter. This one has no enter key. It watches the last few digits you pressed at all times, and the moment those digits happen to match a valid code, that code counts as entered. It does not clear afterwards. The next digit you press shifts the window by one, and you have a new code.
That sliding window is the weakness. Instead of typing each code from scratch, you share all but one digit between one code and the next. A four-digit lock that you tested one code at a time would need four thousand presses for a thousand codes. By overlapping, you can cover all of them in just over a thousand.
The puzzle is to press a string of digits that contains every possible code as a window somewhere inside it, using as few presses as you can.
The three lock sizes
On Small, the keypad has two buttons (0 and 1) and the lock watches the last three presses. There are eight possible codes. The fewest presses to cover all eight is ten: eight codes plus three minus one. The first two presses complete nothing, and after that every press finishes exactly one new code.
On Medium, the keypad still has two buttons, but the lock watches the last four presses. That gives sixteen codes, and the shortest covering string is nineteen presses.
On Large, the keypad grows to three buttons (0, 1, and 2) and the window shrinks to three. Twenty-seven codes, shortest in twenty-nine presses. The extra button makes the choices at each step harder, even though the window is shorter.
How the floor is set
The minimum number of presses has a simple formula. Take the number of codes, add the length of the window, and subtract one. The first presses are an investment: they fill the window with digits that do not form a complete code yet. After the window is full, every single press completes exactly one code. Since no single press can complete two different codes at the same time, one press per code is the best you can do.
Reaching that floor means every press after the opening ones was useful. Not a single digit was wasted on a code you had already seen. That is a perfect run.
Controls and feedback
The digit buttons sit below the tape. Tap a button and the digit appears at the end of the tape. Once the window is full, the most recent window of digits is checked against the code list. If it is a code you have not seen before, the tape highlights that digit as new and the code is crossed off in the panel above.
Below the digit buttons is a Take one back button. It removes the last press and recalculates which codes have been covered. You can undo as many times as you like, all the way to an empty tape.
The stats bar shows how many codes you have covered, how many presses you have made, and the fewest presses possible. The level selector lets you pick Small, Medium, or Large, and New game resets the tape.
Think of it as a route through a network
Here is a way to picture the puzzle. Build a small network in your head. Each place in the network is a possible recent-digits state. For a window of three on two buttons, the places are 00, 01, 10, and 11. Each place has two links leaving it, one for pressing 0 and one for pressing 1.
Pressing a digit moves you from one place to the next. The code you complete is the place you left followed by the digit you pressed. Covering every code means using every link in the network exactly once.
A route that uses every link exactly once is called an Eulerian circuit. It always exists in this network because every place has the same number of links going in as going out. The game builds one behind the scenes to prove that the floor is reachable.
Deal with the repeated codes early
A code made of one repeated digit is trouble if you leave it for later. Take the code 000 on a two-button, three-digit lock. To enter it, you need to press 0 three times in a row. That is easy at the start, but near the end of your run you may find yourself on a string of 1s with no room to triple-tap 0 without wasting presses.
The same goes for 111 and, on a three-button lock, 222. Handle these early. A good opening for a two-button, three-digit lock is 000. That covers the triple-zero code and sets you up at place 00, from which pressing 1 gives you 001.
On the three-button lock, start with 000, then 1, then 111, then 2, then 222. That knocks out all three triple-repeat codes in the first eleven presses and leaves the rest of the run free of traps.
Look one step ahead
At each step you choose which digit to press next. That choice matters because it determines your new position in the network, and some positions have more uncovered links leaving them than others.
If you move to a position where both outgoing links have already been used, you are stuck. Any digit you press will complete a code you have already seen, which is a wasted press. The undo button lets you back out, but the wasted time adds up.
Before you press a digit, ask yourself: from the new place, how many fresh links are still available? If one choice leaves you with two options and another leaves you with none, pick the one with two. This greedy look-ahead catches most dead ends before you fall into them.
On a two-button lock this is a choice between two digits at each step. On a three-button lock it is a choice between three. The more buttons, the easier it is to find a fresh path, but also the easier it is to miss the one that matters.
Common mistakes and how to fix them
Starting over from scratch is the first mistake new players make. You never need to re-enter a whole code. Every press after the window fills completes a new window, so changing one digit gives you a new code. If you find yourself pressing the same three or four digits in a row to repeat a code, stop. Change just the last digit.
Ignoring the code panel is the second. The panel at the top shows every possible code and which ones you have hit. Before pressing the next digit, glance at the panel and see which codes near your current window are still open. If you are sitting on 01 and both 010 and 011 are already covered, neither press is useful from here. Back up and try a different path.
- Never re-enter a full code from scratch. Share digits between codes.
- Watch the code panel. It tells you which codes are still open.
- Handle triple-repeat codes early, before they become traps.
- Look one press ahead. Avoid positions where every outgoing code is already covered.
- Use the undo button freely. Backing up one step is better than wasting three presses.
Why the shortest string always exists
The mathematical name for the shortest covering string is a De Bruijn sequence. One exists for every alphabet size and every window length. The proof is the Eulerian circuit argument: in the network of recent-digit states, every place has equal numbers of links going in and coming out. A circuit that uses every link once must therefore exist.
The game constructs one each time you start a new round. It is not shown to you, but it is used to confirm the par. If you match the par exactly, you have found a De Bruijn sequence. Yours may be different from the one the game found, but it is equally correct.
This idea is not just a theoretical curiosity. Real keypads that have no enter key are genuinely vulnerable to this approach. A four-digit pin on a ten-button pad would normally require forty thousand presses to test every code individually. A De Bruijn sequence covers them all in just over ten thousand. The sliding window turns a brute-force marathon into something surprisingly short.
No data leaves your device
Every code, every press, and every undo runs inside your browser. There is no server keeping track of your sequence or your score. Your best result is stored in your browser's local storage on this device only. You can load the page, disconnect from the internet, and keep playing. The keypad, the tape, and the code panel all work without a network connection.
