31
$\begingroup$

What is the smallest box diagram you can draw which uses all of the Unicode box drawing characters at least once, but without leaving any loose ends? For reference, you must use each of these characters at least once (not counting the spaces, which are just there for alignment purposes):

─ │ ┌ ┐ └ ┘ ├ ┤ ┬ ┴ ┼
═ ║ ╔ ╗ ╚ ╝ ╠ ╣ ╦ ╩ ╬
    ╒ ╕ ╘ ╛ ╞ ╡ ╤ ╧ ╪
    ╓ ╖ ╙ ╜ ╟ ╢ ╥ ╨ ╫

By loose ends, I mean:

┌┐ <-Allowed  ┌┐ <-Not allowed  ┌┐┌┐ <-Allowed
└┘            └┴                └┴┴┘

Also, all single-lines must line up with single lines and doubles must line up with doubles, so:

├─, ╟─, ╠═, ╞═ <-Allowed  ├═, ╟═, ╠─, ╞─ <-Not allowed

You may use characters more than once each, but each character must appear at least once. You may make multiple unconnected shapes - it is not necessary to create one single connected shape, so long as all of the ends are closed off. (But see the bonus below.)

Entries will be graded code-golf style. Count the number of characters (including spaces, either leading or internal) used in your entry and include it in bold as a header. Newlines are free (to prevent conflicts between 1-char and 2-char newlines on different OS's). Then subtract 40 points (one for each of the required characters). (A perfect score of 0 would thus use each character exactly once with no duplicates.) Lowest score after one week wins.

Bonus:

Create a diagram which is one contiguous shape. All other rules apply as previously. If you create both a contiguous graph and a non-contiguous set of graphs, your overall score will be the average of both scores divided by two.

$\endgroup$
7
  • 3
    $\begingroup$ Those are all Unicode characters, not ASCII. $\endgroup$
    – jwodder
    Commented Nov 2, 2015 at 19:13
  • $\begingroup$ Did you mean the score would be the average of the two or the average of the two divided by two. I.E., as it is written right now, that would give @Keeta a score of 1 because (average(2,2))/2 = 1. $\endgroup$ Commented Nov 2, 2015 at 19:38
  • $\begingroup$ @EngineerToast: Honestly, I'm not sure anymore. I thought just a straight average, but that disincentives anyone to make the contiguous one, which is why I added the divided by 2 bonus. Always challenging to find a way to change the scoring method after first posting without screwing anyone over... $\endgroup$ Commented Nov 2, 2015 at 20:00
  • 2
    $\begingroup$ @DarrelHoffman: Code Page 437 is a superset of ASCII, and the characters in it that are not from ASCII are, um, not part of ASCII. The box drawing characters are among those that are not ASCII. $\endgroup$ Commented Nov 2, 2015 at 20:08
  • 1
    $\begingroup$ @DarrelHoffman: An extension of ASCII is not the same as ASCII itself. ASCII is a well-defined technical term referring to ANSI X3.4, and there is no doubt or ambiguity about which printable characters are in the character set this term names. The box-drawing characters of CP437 are not in it. The quip about many standards to choose from does not change the fact that only one of those standards is ASCII. Character sets other than ASCII, even if they happen to extend ASCII, are not ASCII. $\endgroup$ Commented Nov 2, 2015 at 21:17

4 Answers 4

37
$\begingroup$

Score 0

Found using a small program.

$10 \times 4$ grid:

┌─┐╔═╗╒╦╤╕
├╥┤╟┬╢╘╣╞╛
│╠╪╬╡║╓╫┼╖
└╨┘╚╧╩╝╙┴╜

$ 8\times5 $ grid:

┌─┐╔═╗╒╕
╞╦╡║╓╨┴┘
├╫┼╢╙╥┬╖
│╟┤╠╤╬╪╣
└╜╘╩╛╚╧╝
$\endgroup$
8
  • $\begingroup$ Nice! What search strategy did you use? $\endgroup$ Commented Nov 2, 2015 at 22:12
  • $\begingroup$ @2012rcampion I defined a 10*4 grid, and let the computer fill it from left to right, top to bottom, checking for each part if it fits. Primitive brute forcing would probably not work (40! possibilities). $\endgroup$
    – Sleafar
    Commented Nov 2, 2015 at 22:20
  • $\begingroup$ I think we have a winner! I had no idea it could be done without ANY duplicates. I'm now curious if it could also be done in an 8*5 grid? $\endgroup$ Commented Nov 2, 2015 at 22:22
  • $\begingroup$ @DarrelHoffman I can check it tomorrow, it's late here already. There are tons of other 10*4 solutions, so it's probable that there are also solutions for other grids. $\endgroup$
    – Sleafar
    Commented Nov 2, 2015 at 22:29
  • 1
    $\begingroup$ @DarrelHoffman Don't worry about esolangs - you can generally rely on the community to judge validity of those. After all, no-one can be expected to know them all. I for one tend to steer away from the esolangs, and can't really claim to know any of them. Bottom line: if you think you have a good PPCG challenge question, go ahead and post it to the sandbox $\endgroup$ Commented Nov 4, 2015 at 0:41
18
$\begingroup$

Score: 2 42 Characters, 2 duplicates - Sorry that I don't know how to format.

┌╥╖╓┬┐╔═╦╕
╞╬╣╠╪╡╟─╫┤ 
└╨╜╙┴┘╚═╩╛ 
╒╤╗ 
││║ 
├┼╢ 
╘╧╝

Bonus challenge: Score: 2 42 Characters, 2 duplicates

╒╤╦╗╔╕╓╥╖┌┬─┐
├┼╢╟╫┤╠╬╣╞╪═╡
││║╚╩╧╝╙╨┘╘═╛
└┴╜
$\endgroup$
2
  • $\begingroup$ Welcome. Nice, didn't think less than 4 was possible. And now I see the flaw in my scoring for the bonus - might be hard to come up with a contiguous set small enough that it doesn't actually increase the score... $\endgroup$ Commented Nov 2, 2015 at 18:51
  • $\begingroup$ I guess after the latest edit (adding the contiguous diagram) I should remove the first non-contiguous set. Maybe it makes more sense to leave it so that comments don't seem confusing. Leaving it for now. $\endgroup$ Commented Nov 2, 2015 at 19:29
5
$\begingroup$

Score: 5

Duplicates = 4, Spaces = 1

╔╦╗┌┬┐╓╥╖╒╤╕╔═╕
╠╬╣├┼┤╟╫╢╞╪╡║ │
╚╩╝└┴┘╙╨╜╘╧╛╙─┘

For a contiguous shape: 9

Duplicates = 9, Spaces = 0

╔╦═╗
╠╬╤╣
╟╫┼╢
╚╩╡║
┌┬┴╜
││╓╖
╘╧╝╙┐
╒╕┌╥┤
╞╪╛╙┘
├┴┐╔╗
└─┴╨╜
$\endgroup$
5
  • $\begingroup$ This looks pretty optimal, not sure if anyone can top that. Maybe I should've made it more interesting and required it to be one contiguous shape instead of allowing separate ones... $\endgroup$ Commented Nov 2, 2015 at 17:30
  • $\begingroup$ @DarrelHoffman You can always post that challenge as a separate question... $\endgroup$ Commented Nov 2, 2015 at 18:00
  • $\begingroup$ After edit: That IS more interesting. Is this puzzle new enough that it would be acceptable to change the rules slightly? I doubt there will be more submissions using the non-contiguous ones that can challenge this one, but there may be room for optimization on the contiguous one that would be cool to see... $\endgroup$ Commented Nov 2, 2015 at 18:10
  • $\begingroup$ @DarrelHoffman You could edit it to have two different challenges in one. For instance, primary challenge is the original but a bonus challenge is to make a contiguous shape. $\endgroup$ Commented Nov 2, 2015 at 18:32
  • $\begingroup$ I added a bonus challenge. It was tricky coming up with a scoring which gives an improved score for both graphs being smaller while not simultaneously screwing up anyone who only made one, but that was the best I could come up with. $\endgroup$ Commented Nov 2, 2015 at 18:42
3
$\begingroup$

Averaged score 6

50 characters, includes 2 spaces. I'll keep working on improvements.

UPDATE: 46 characters, no spaces. I suspect there's a way to deal with the triple '|' in the first figure...

┌╥┬┐╔╤╦╗╒╤╕╓╥╖
│║││╠╧╬╣╞╪╡╟╫╢
├╨┼┤╚═╩╝╘╧╛╙╨╜
└─┴┘        

Contiguous: 48 characters, 0 spaces.

UPDATE: 46 characters, includes 1 space

╔╦╤╗
║╟┼╢
╠╬╧╣
╚╩╤╝
╒═╪╕
╘╦╧╛
╓╫╖
╙╫╜
┌╨┬┐
│ ╞╡
├╥┼┤
└╨┴┘

I know it's been solved perfectly, but I'm going to keep trying to improve my solution.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.