# Box drawing characters puzzle

## Puzzle

Remeber good old days when PCs were already around, but Windows wasn’t? Program ran in text mode and those that wanted “GUI” used box drawing characters to draw the dialog boxes, buttons, window frames and lots of other stuff. If you do not remember, here are box drawing characters:
``` ┌ ┬ ┐ ╒ ╤ ╕ ╓ ╥
╖ ╔ ╦ ╗ ─ │ ║ ├
┼ ┤ ╞ ╪ ╡ ╟ ╫ ╢
╠ ╬ ╣ ═ └ ┴ ┘ ╘
╧ ╛ ╙ ╨ ╜ ╚ ╩ ╝
```
Arrange these characters into connected shape so that all ends match: single end connects to single end and double end connects to double end and there are no hanging ends. IT is OK to use any number of spaces but each box drawing characters must be used once and only once.

For example, figure

``` ┌┬┐ ╒╤╕ ╓╥╖ ╔╦╗ ─ │ ║
├┼┤ ╞╪╡ ╟╫╢ ╠╬╣ ═
└┴┘ ╘╧╛ ╙╨╜ ╚╩╝
```
tacks nicely all corner pieces, but straight pieces remain untacked. Also, the resulting figure is not connected.

## Solution

### Symmetrical solutions

The following is not the story as it actually happened, but rather the story I wished to happen. ...
(The story is omitted)

### 4x10 solutions

There are quite a few. I end up writing program that gets solutions by trying to fit 40 characters into 4x10 rectangle and checks if ends fit. This program found 10000 solutions and was far from done when I interrupted it. Here are first few.
```╒╕╔╗┌┐╓─┬╖ ╒╕╔╗┌┐╓─┬╖ ╒╕╔╗┌┐╓─┬╖ ╒╕╔╗┌┐╓─┬╖ ╒╕╔╗┌┐╓─┬╖ ╒╕╔╗┌┐╓─┬╖
├┼╨╫┤│╠╦╛║ │├╨╫┼┤╠╦╛║ │╘╝╠╡├╫╥┤║ │╞╬╩╡└╫╥┤║ ├┼╫╨┘│╟╥┤║ ├┼╫╨┘│╟╥┤║
╞╪╤╬╡╘╣╟╥╢ ╞╪╤╬╡╘╣╟╥╢ ╞╤╦╬╧╪╣╟┼╢ ├┘╠╦╪╤╣╟┼╢ ╞╪╬╤╦╡╠╣└╢ ╞╡╠╤╦╪╬╣└╢
└┴┘╚╧═╩╝╙╜ └┴┘╚╧═╩╝╙╜ └┘╚╩═╛╙╨┴╜ ╘═╝╚╧╛╙╨┴╜ ╘╧╩╛╙┴╜╚═╝ ╘╧╩╛╙┴╜╚═╝
```

### 5x8 solutions

```┌╖╒╕╓┬─┐ ┌╖╒╕╓┬─┐ ┌╖╒╕╓┬─┐ ┌╖╒╕╓┬─┐ ┌╖╒╕╓┬─┐ ┌╖╒╕╓┬─┐ ┌╖╒╕╓┬─┐
╞╣╘╪╩╧═╛ ╞╬╧╡║╘═╛ ╞╩╪╧╣╘═╛ ╞╩╪╧╣╘═╛ ╞╩╪╧╣╘═╛ ╞╩╪╧╣╘═╛ ╞╬╪╧╣╘═╛
├╫╥┤╔╤╦╗ ├╢╔╪╩╤╦╗ ├╥┤╔╬╦╤╗ ├╥┤╔╬╦╤╗ ├╥┤╔╬╤╦╗ ├╥┤╔╬╤╦╗ ├╫┤╔╩╤╦╗
│╠╬╡╟┼╢║ │╟╫┼╥┤╠╣ │╠╡║╟╫┼╢ │╟┼╫╢╠╡║ │╠╡║╟┼╫╢ │╠╡╟╫┼╢║ │╠╡╟╥┼╢║
└╜╙┴╨┘╚╝ └╜╙┴╨┘╚╝ └╨┘╚╝╙┴╜ └╨┘╚╝╙┴╜ └╨┴╜╙┘╚╝ └╨┴╜╙┘╚╝ └╨┴╜╙┘╚╝
```
There are 347871 ways to fill 5×8 rectangle, not counting those that can be obtained by symmetries.

### 3x14 solutions

Are there any solutions just 3 characters high? Obviously, 2 characters is not tall enough and solutions 4x10 exist and are 4 characters high, so the open question is height 3. The program failed to found a way to fit 40 boxdrawing characters plus 2 spaces into 3×14 rectangle.

### 6×7

```┌┐╓╖╒═╕ ┌┐╓╖╒═╕ ┌┐╓╖╒═╕ ┌┐╓╖╒═╕ ┌┐╓╖╒═╕ ┌┐╓╖╒═╕ ┌┐╓╖╒═╕ ┌┐╓╖╒═╕
│└╨╫┼╥┘ │└╜║╞╦╛ │└╢╟┼╥┘ │└╫╨┼─┤ │└╢╟┼─┤ │└╢╟┼╥┘ │└╨╢╞╤╡ │└╜║╞╦╛
├─┬╢╞╣  ├┬╥╫┼╢  ├┬╨╫┤║  ├┬╢ ╞╦╛ ├┬╫╨┴╥┘ ├┬╫╨┤╠╗ ├┬╥╫┴┼┘ ├┬─╫┤╠╗
╘╤╛╟┤║  ╘╡╟╨┤╠╗ ╘╪╤╩╡╠╗ ╘╡╟╥┘║  ╘╪╬╤╦╣  ╘╡║ ╞╩╣ ╘╛╠╬╦╪╗ ╘╧╤╬╪╩╣
╔╪╦╬╡╠╗ ╔╪╩╤╧╬╣ ╔╛╞╦╧╬╣ ╔╪╣╠╤╬╗ ╔╡║╞╝╠╗ ╔╪╬╤╧╦╝  ╔╩╣╟┤║  ╔╡╟┼╥╢
╙┴╜╚╧╩╝ ╙┴─┘ ╚╝ ╙─┴╜ ╚╝ ╙┴╜╚╧╩╝ ╚╧╩╛ ╙╜ ╚╛╙┴─╜   ╙─╜╚╧╝  ╙┴╨┘╚╝
```
There are many ways to cover 6×7 rectangle with 40 boxdrawing characters plus 2 spaces.

## Variations

Unicode defines more box drawing characters. Can you fit all of them using each only once into similar structure?
[ Index page | Puzzle | Feedback ]