14
2
Intro
In most fonts all of the uppercase alphabet characters besides BDO
have single lines approximately touching some of the four corners of the character's bounding rectangle: ACEFGHIJKLMNPQRSTUVWXYZ
.
For example, the two legs of an A
"touch" the bottom left and bottom right corners of the character. Likewise, C
touches its top and bottom right corners (it is a bit curved but it's close enough). L
only touches it's top left and bottom right corners with single lines. The bottom left corner of L
is a vertex, not the end of a single line.
Here is a table of what characters touch which corners according to the Stack Exchange font I (and hopefully you) see. 1
is for upper left, 2
is for upper right, 3
lower left, 4
lower right.
A: 3 4
C: 2 4
E: 2 4
F: 2 3
G: 2
H: 1 2 3 4
I: 1 2 3 4
J: 1 3
K: 1 2 3 4
L: 1 4
M: 3 4
N: 2 3
P: 3
Q: 4
R: 3 4
S: 2 3
T: 1 2
U: 1 2
V: 1 2
W: 1 2
X: 1 2 3 4
Y: 1 2
Z: 1 4
Setup
Pretend like these corner touching lines extend in the direction of the corner that they touch so that arrangements of these characters on a grid can be "connected".
For example, all the characters in
A
C X
are connected because the bottom left of A
and top right of C
connect, and the bottom right of A
and top left of X
connect.
However,
CAX
has no connections because connections only occur diagonally from one character to the next.
Challenge
Write the shortest program possible (in bytes) that outputs all of the characters in ACEFGHIJKLMNPQRSTUVWXYZ
in one big fully connected tree, according to the rules above. Each character must appear exactly once. Use spaces for empty space.
Example
Everything in this 23-letter tree can be reached from anything else via the diagonal connections defined above:
Q
A J R
C U S Y
I M N
E H X
F L T
G Z K P
V W
Notes
- You may hardcode your solution.
- Your output should only contain
ACEFGHIJKLMNPQRSTUVWXYZ
, spaces, and newlines.BDO
will not be used. - Leading/trailing spaces are fine as long as all the connections are properly positioned.
- The output grid should not be larger than 30 by 30 characters (including newlines and spaces).
- Only corner connections are considered. The bottom of
Y
does not connect to anything. You must use the corner connections from the table above. - Not all connectable corners need to connect to something. Connectable and non-connectable corners may border each other.
- Output to stdout. There is no input.
- Including a connectivity graph made with slashes as Peter Taylor has done is a helpful touch but not required.
Update:
githubhagocyte has made an alphabet tree validity checker over on Github.
You may hardcode your solution? – edc65 – 2014-08-07T10:48:16.833
2@edc65 You may hardcode your solution. – Calvin's Hobbies – 2014-08-07T10:53:56.190
7Funny how those 2 phrases only have 1 different character :P – Teun Pronk – 2014-08-07T10:57:51.177
Wny not accept a graph as an output? That way, the connections are prominent. – DavidC – 2014-08-07T11:42:42.957
@githubphagocyte I don't see why not. – Calvin's Hobbies – 2014-08-07T12:24:41.977
1@githubphagocyte, that would be better as an addendum to the question than as an answer, given that it's not an answer. – Peter Taylor – 2014-08-07T13:59:05.347
@githubphagocyte You could give me a link to the code and I'll edit it in with credit to you. – Calvin's Hobbies – 2014-08-07T14:05:52.273
@githubphagocyte, if it's short, edit it in. If it's not, put it somewhere like gist.github.com and edit in a link. – Peter Taylor – 2014-08-07T14:10:06.847
B and D should both touch top and bottom left hand side shouldn't they? They look like it on my screen – Tom Tanner – 2014-08-07T15:13:42.097
@TomTanner Only the endpoints of single lines count, not vertices. – Calvin's Hobbies – 2014-08-07T15:58:00.183
1Nice golf, @Calvin'sHobbies. This one's a lot of fun to see the answers for. – Jordan – 2014-08-07T17:44:37.100
xkcd 1442 makes me wonder if Randall Munroe reads your questions as inspiration. – trichoplax – 2014-11-16T20:38:04.667