# Connect dots on a grid with one continuous line (optimization)

(This question is the third puzzle of the Connect dots puzzle series. You can find the first two puzzles here and here, respectively.
The original question and photos originate from webadventurer. This optimization question was first asked by user21820.)

Rules:

1. Line must be straight.
2. Line must be continuous.
3. Line must not intersect itself.
4. Line is allowed to take 45 degree turns to itself, for example:

The dots:

Question: what is the minimum number of bends required to connect all the dots with one line? In addition, how would this number change if we include the fifth rule:
5. Line must not leave the square.

(Bonus question: Is it possible to prove the lower bound? Is there an equation for the lower bound given $$n \times n$$ dots on a grid?)

Without rule 5, the record currently belongs to Florian F with 12 bends (13 lines), whose solution can be found here.

With rule 5, the record also currently belongs to Florian F with 24 bends (25 lines), whose solution can be found here.

• Do you mean 135?
– Moti
Sep 3, 2023 at 1:33
• In the linked answer, Florian F has found a solution to the bonus with 20 bends (21 lines). Oct 20, 2023 at 22:52