33
4
I have an ASCII-art box and I need a program to open it.
Examples
Input:
-------
| |
|_____|
Output:
/
/
/
/
/
/
/
| |
|_____|
Specification
- The first line will only consist of
-
, at least 3 of them - The middle rows will start with
|
have spaces, and end with|
- All the middle rows will be the same
- The last row will start with
|
have_
and end with a|
- All rows will be the same length
Opening the box:
- Each
-
should be replaced by a/
in ascending lines and position.
2As opposed to the game "Shut the Box"? – Addison Crump – 2016-01-31T19:14:18.537
Is a leading newline acceptable? – ETHproductions – 2016-01-31T19:58:11.443
@ETHproductions errr, uh.... sure, why not ¯\(ツ)/¯ – Downgoat – 2016-01-31T19:59:40.593
Can I read input from a file? – Conor O'Brien – 2016-01-31T20:17:22.233
1cough – Addison Crump – 2016-01-31T21:24:18.470
@CᴏɴᴏʀO'Bʀɪᴇɴ sure, why not ¯\(ツ)/¯; – Downgoat – 2016-01-31T21:25:04.573
28The lid becomes twice as long when opened? Oh well, blame ASCII art. – Darrel Hoffman – 2016-01-31T21:46:24.163
Can I require a training newline in the input? MATL reads each line as a separate input, so an empty line (i.e. a newline) would mark the end – Luis Mendo – 2016-01-31T22:50:43.837
1@LuisMendo yeah, just state that in your answer – Downgoat – 2016-01-31T22:51:40.667
8What's in the box? – Williham Totland – 2016-02-01T11:58:25.290
1
@WillihamTotland Something shiny
– Luis Mendo – 2016-02-01T12:23:44.2631
This would be 13 bytes in Crayon, just beating all the other entries:
– ETHproductions – 2016-02-01T14:58:23.840'<->+'"↗/%1"r
That is, match all the hyphens and store the number of matched hyphens in%1
, then replace it with a string of%1
slashes pointing north-east.Actually, that would be with implicit input, which I've decided against. Fortunately, there's a 10-byte version with explicit input:
Ll`/*↗q↩Eq
Mind if I post it as non-competing? – ETHproductions – 2016-02-01T16:07:35.230@ETHproductions if there is a working interpreter and it complies with the rules then Yes. – Downgoat – 2016-02-01T16:09:39.720
2There's not a working interpreter, so I guess not then. Doesn't matter; when I do make the interpreter (soon, hopefully), I'll post the answer. – ETHproductions – 2016-02-01T16:10:07.147
@ETHproductions you can post it now I guess:) – JayCe – 2018-08-18T14:25:10.217