One-Line Drawing Puzzles: How to Solve Every One
Can you draw it without lifting your pen? The simple rule that tells you if a one-stroke puzzle is solvable and where to start, plus tips for one-way and double lines.
To solve a one-line drawing puzzle, count how many lines meet at each dot. If every dot has an even number of lines, you can start anywhere and you'll finish where you began. If exactly two dots have an odd number, you must start at one of them and you'll finish at the other. If more than two dots are odd, the shape can't be drawn in one stroke at all, however clever you are. That one rule, worked out by Leonhard Euler in 1736, tells you whether a puzzle is possible and where to put your finger down. The rest is avoiding a couple of traps on the way round, which I'll go through below with small examples.
The rule: count the lines at each dot
Every time your pen passes through a dot, it uses two lines: one to arrive and one to leave. So a dot you only ever pass through must have an even number of lines. The only dots allowed an odd number are the one you start at (where you leave without arriving) and the one you finish at (where you arrive without leaving).
That gives three cases:
- No odd dots. Start anywhere. Your stroke will end back where it started.
- Exactly two odd dots. Start at one odd dot and you'll finish at the other. Start anywhere else and you'll get stuck, every time.
- Four, six or more odd dots. Impossible in one stroke. Each odd dot needs to be an end of the stroke, and a stroke only has two ends.
You'll never find a shape with exactly one or three odd dots. Each line adds one to the count at both of its ends, so the total across all the dots is always even, and that means the odd dots come in pairs. If you count three, you've miscounted somewhere.
There's one more condition, which is usually obvious: the shape has to be in one piece. Two separate squares can't be drawn in one stroke, even though every dot is even.
Mathematicians call a route that uses every line exactly once an Eulerian path, and one that ends where it started an Eulerian circuit. Euler showed the counting rule was necessary; the German mathematician Carl Hierholzer proved in 1873 that it's also enough, meaning that if the counts are right, a route always exists. So a shape with zero or two odd dots is always solvable, and the only question is finding the route.
Where the rule comes from: the bridges of Königsberg
The city of Königsberg, now Kaliningrad, sat on both banks of the river Pregel and on two islands in the middle, joined by seven bridges. A local puzzle asked whether you could walk through the city crossing every bridge exactly once. Nobody could find a way, and in 1736 Euler explained why not (Seven Bridges of Königsberg).
He realised the shape of the streets didn't matter. All that mattered was which pieces of land each bridge connected. Treat each piece of land as a dot and each bridge as a line, and you get a drawing with four dots. One had five bridges and the other three had three each. Four odd dots, so no walk can cross every bridge once. It's widely seen as the start of graph theory, the branch of maths about dots and the lines between them, which now sits behind everything from route planning to how computers sequence DNA.
Every one-line drawing puzzle is the Königsberg problem in disguise. The dots are the land, the lines are the bridges, and you're the person out for a walk.
Worked example: the house
The classic one is the house: a square with both diagonals drawn in and a triangle roof on top. In Germany children learn it with the rhyme "Das ist das Haus vom Nikolaus", one syllable per line, and it's in plenty of other countries' playgrounds too. It's also the third level of Oneline.
Count the lines at each dot. The diagonals cross in the middle of the square, but there's no dot there, so you just go straight over.
| Dot | Lines meeting there | Odd or even |
|---|---|---|
| Roof peak | 2 (both sides of the roof) | Even |
| Top left and top right | 4 each (side, top, diagonal, roof) | Even |
| Bottom left and bottom right | 3 each (side, bottom, diagonal) | Odd |
Two odd dots, both at the bottom. So the house can be drawn in one stroke, but only if you start at a bottom corner. Start at the roof peak and you'll always end up stuck with a line or two left over. One route from the bottom left: up the diagonal to the top right, across to the top left, up to the peak, down to the top right, down the side to the bottom right, across the bottom, up the left side, then down the other diagonal. Eight lines, and you finish at the bottom right, the other odd dot, just as the rule promised.
Smaller examples to check the rule
- A plain square. Every corner has two lines, so all four are even. Start anywhere, go round, finish where you began. This is Oneline's first level.
- A square with one diagonal. The two corners the diagonal touches now have three lines each, and the other two still have two. Start at one end of the diagonal and you'll finish at the other. Start at one of the other corners and you can't do it. This is the second level, and it's there to teach exactly that.
- A square with both diagonals but no roof. All four corners have three lines. Four odd dots, so it's impossible, which surprises people because it looks simpler than the house. The roof is what fixes it: it adds a line to each top corner, making them even.
How to find the route once you know where to start
Knowing the start point is most of the battle, but you can still trap yourself halfway round. The usual way is to finish off one part of the shape while another part still has lines left, with no way back to it.
The fix is a rule of thumb from an old method called Fleury's algorithm: don't use a line that's the only link to an untraced part of the shape unless you have no other choice. If a single line is the last bridge between where you are and a cluster of untraced lines, cross it last, after you've used up everything on your side.
In practice, that means a few habits:
- Count first. Find the odd dots before you touch anything. It takes a few seconds and saves most failed attempts.
- Clear loops as you pass them. If you're at a dot with a small loop hanging off it, go round the loop now. Leave it for later and you may never get back.
- Look one move ahead at junctions. When you have a choice, ask whether either option would cut the remaining lines into two pieces. Take the one that doesn't.
- Head for the finishing dot last. With two odd dots, the second one is your exit. Avoid passing through it early if it would use up its last spare line.
Double lines
A double line has to be traced twice. The easiest way to think about it is as two separate lines that happen to lie on top of each other. Each pass counts once at both ends, so a double line adds two to the count at each of its dots.
Adding two never changes whether a number is odd or even. So double lines don't move the start point: count them as two and the odd dots come out the same as if the line were single. What they change is the route. You have to cross that stretch once, do something else, and come back for it, which usually means the double line sits between two parts of the shape that you visit in turn. A common mistake is to trace it twice in a row by going back and forth. That's allowed if it fits the route, but it often leaves you on the wrong side of the shape.
One-way lines
A one-way line has an arrow, and you can only trace it in that direction. This changes the counting. Instead of counting lines at each dot, count arrows in and arrows out separately.
- At a dot you pass through, every arrival is matched by a departure, so arrows in must equal arrows out.
- The start dot can have one more out than in.
- The finish dot can have one more in than out.
For a shape where every line is one-way, that's the full rule (the directed version of Euler's result). If one dot has more arrows leaving than arriving, you must start there. If every dot is balanced, start anywhere and you'll end where you began.
Most puzzles, including Oneline, mix one-way and ordinary lines, and there the counting gets fiddlier because you get to choose a direction for each ordinary line. The ordinary rule still has to hold for the shape as a whole, so start by finding the odd dots as usual. Then use the arrows to break the tie: a one-way line pointing away from a dot is a good sign it's a start, and a dot where all the one-way lines point in is a likely finish. Two arrows pointing into a dot with no ordinary lines to get out on is a dead end, so make sure you finish there or arrive with a way out still open.
How Oneline works
Oneline is one of the twelve Journey games in Habz, and opens at level 25. It has 200 levels along a map, and each one is a shape on a grid of dots that you trace with your finger. You lose a go when you get stuck, with lines left but none you can reach, and the shape resets.
- Three tries a level. Get stuck three times and the level is lost.
- Stars for solving it on the first go. Three stars on the first try, one fewer for each extra try. So the counting trick is worth stars, not just pride.
- Shapes grow as you go. The first three levels are the square, the square with a diagonal and the house. After that, shapes sit on a 3 by 3 grid of dots, then 3 by 4, 5 by 4, 5 by 5 and finally 5 by 6, with more lines each time.
- Double lines arrive from level 26, and one-way lines from level 66. By the end, shapes have over 20 lines with doubles and arrows mixed in.
Like everything in Habz, it's free, with no ads, no lives to wait for and nothing to buy. It works offline in the app, and you can also play it in a browser.
Play Oneline free in your browser
If you like this kind of tidy logic, Linkup is the pipe-connecting cousin; see free games like Flow Free. Gems, the Queens-style puzzle, is in free games like LinkedIn Queens, and there's a round-up of the rest in logic puzzle games without ads.
Is it good for your brain?
I'd rather not oversell it. Research on brain training finds you mostly get better at the thing you practise, and I go through that in do brain training games work? What one-line puzzles do have going for them is a real idea underneath. Once you know the odd-dot rule, you stop trying random starts and begin reasoning about the shape, which is a nice small example of a bit of maths changing how you see a problem. And it's a good feeling to look at a puzzle that's beaten you for minutes and know straight away where to begin.
Frequently asked questions
How do you solve a one-line drawing puzzle?
Count the lines meeting at each dot. If two dots have an odd number, start at one of them and you will finish at the other. If every dot is even, start anywhere and you will finish where you began. Then avoid crossing a line that is the only link to an untraced part of the shape until you have to.
How do you know if a shape can be drawn without lifting your pen?
It must be in one piece and have either zero or exactly two dots where an odd number of lines meet. With four or more odd dots, it cannot be drawn in one stroke. This is Euler's rule from 1736.
Where do you start the house puzzle?
At one of the two bottom corners. They are the only dots with an odd number of lines (three each), so the stroke has to start at one and finish at the other.
What changes with one-way and double lines?
A double line counts as two lines, so it adds two at each end and never changes which dots are odd. With one-way lines, count arrows in and out: the start can have one more out than in, the finish one more in than out, and every other dot must balance.
Is there a free one-line puzzle game without ads?
Oneline in Habz has 200 one-stroke levels, from a simple square to shapes on a 5 by 6 grid with double and one-way lines, with three tries a level and stars for solving it first time. It is free with no ads, on iPhone, Android and in the browser.