23
4
Here is an ASCII saltine cracker:
_________________
| . . . |
| . . |
| . . . |
| . . |
| . . . |
|_________________|
Here are two crackers stacked:
_________________
| . . . |
| . __________|______
| . | . . . |
| .| . . |
| . | . . . |
|______| . . |
| . . . |
|_________________|
Write the shortest program possible that takes a positive integer and draws a stack of that many ASCII saltine crackers.
Input may come from stdin, command line, or you may simply write a function. The input will always be valid. Output must go to stdout or closest alternative.
Each stacked cracker is always shifted 2 characters down and 7 characters right of the cracker below it. There should be no trailing spaces or extraneous newlines.
The shortest program in bytes wins.
Examples
If the input is 1
the output is
_________________
| . . . |
| . . |
| . . . |
| . . |
| . . . |
|_________________|
If the input is 2
the output is
_________________
| . . . |
| . __________|______
| . | . . . |
| .| . . |
| . | . . . |
|______| . . |
| . . . |
|_________________|
If the input is 3
the output is
_________________
| . . . |
| . __________|______
| . | . . . |
| .| . __________|______
| . | . | . . . |
|______| .| . . |
| . | . . . |
|______| . . |
| . . . |
|_________________|
And so on.
1How does the outline of the cracker below overrides the outline of the one above it? – proud haskeller – 2014-10-06T15:42:23.813
For 0, should the program cleanly exit with no output? Or do we not have to handle 0? – Claudiu – 2014-10-06T15:49:29.383
@proudhaskeller The cracker pattern extends as you would expect from the examples. What about the border is unclear? – Calvin's Hobbies – 2014-10-06T15:53:46.853
1@Calvin'sHobbies: I think he's questioning why the top border of the stacked crackers is
___|___
instead of_______
. I'm guessing it would look weird if it were the latter – Claudiu – 2014-10-06T15:54:40.9332@Claudiu Oh. Yeah, it's not perfect but it looks weirder the other way. – Calvin's Hobbies – 2014-10-06T15:55:49.627
6@Calvin'sHobbies In fact, I think that single character is the most interesting part of this challenge. ^^ – Martin Ender – 2014-10-06T16:05:38.203
3Passing 0 should segfault. – Naftuli Kay – 2014-10-06T21:37:30.030