45
3
All Aboard the ASCII Train!
o O O ___ ___ ___ ___ ___ ___ ___ ___ ___
o | C | | O | | D | | E | | | | G | | O | | L | | F |
TS__[O] |___| |___| |___| |___| |___| |___| |___| |___| |___|
{======|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|
./o--000'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'
You best be prepared to ride the train, because you're about to build the train you'll be riding on. Given a string s
, output a fully formed train as depicted above. The first thing output is always the engine that'll be tugging your string along, as depicted alone below:
o O O
o
TS__[O]
{======|
./o--000'
Following the locomotive are rail-cars containing each character of your precious cargo. To save confusion when unloading, your company has tasked you with labeling the outside of these cars. The cars in question will always look like this:
___
| # |
|___|
_|"""""|
"`-0-0-'
Where the #
is representative of the character that is inside the "cargo" hold. Chaining the engine to each car is also part of your job, as you've been tasked with overseeing the fluidity and success of this entire shipment. So, once you've labeled all the cars and got the engine on the tracks, you must ensure that the train is assembled and ready to roll.
Rules
- The only input your program should take is a single string.
- The engine must always be output, even if your shipment is empty.
- Each car can only hold one character, don't push your luck you may damage the goods.
- You need only support the following printable ASCII characters:
_-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
If you end up doing more, that's fine too, but this is the bare minimum. - 1-2 trailing spaces are acceptable, as is a single trailing newline.
- This is code-golfascii-art, shortest byte-count wins.
4Vaguely related. – Martin Ender – 2016-11-30T22:33:21.613
1
I don't think this is actually [tag:kolmogorov-complexity]. Based on this meta post this question is certainly on the line between fitting and not fitting our definition and I would personally say that it does not fit the tag similar to this question which also asks for a type of string wrapping.
– Post Rock Garf Hunter – 2016-12-01T04:05:49.5935This is beautiful [tag:ascii-art] – CAD97 – 2016-12-01T05:19:16.283
@WheatWizard it's a mixture of multiple genres. The engine would fall under kolmogrov complexity, the whole thing under ASCII-Art and it probably also falls a little bit into string manipulation. – Magic Octopus Urn – 2016-12-01T14:23:22.347
I was under the impression that compressing the actual pattern of the train would be worthy of the tag; but I'll just remove it to stop the argument. – Magic Octopus Urn – 2016-12-01T17:46:01.580
Can the input contain newlines? If so, what label should be placed on the train cars? (Trying to label them with a newline would cause them to fall apart.) – None – 2016-12-01T19:28:07.337
@ais523 don't worry about newlines or tabs, or anything else that would be beyond a single space. – Magic Octopus Urn – 2016-12-01T19:30:39.960
Could this fit under [tag:string]? – FlipTack – 2016-12-03T17:56:27.803
I'm going to attempt a BrainF*** solution; can I take the number of letters in the string first? – HyperNeutrino – 2016-12-03T22:21:12.413
@HyperNeutrino yes. – Magic Octopus Urn – 2017-05-02T15:38:58.387