28
Today, November 11th, is known as Remembrance Day, Armistice Day, or Veterans Day (depending upon the country), and is a day of reflection and gratitude for members of the military and their service, specifically started to reflect the end of European hostilities in the first World War. Let us reflect on that with a simple ASCII-art output of 11/11
.
Given an input n
, output an ASCII-art rendition of 11/11
that is n
units tall. Specifically, each 1
is composed of vertical pipes ||
, the slash is composed of slashes //
, and each character is two spaces apart. Note that this means varying output widths -- for example, for n=3
below, see how the "bottom" of the slash is two spaces from the 1
to its left, but is four spaces from the 1
on its right, so that the top of the slash lines up appropriately and is two spaces from the 1
on its right.
n = 1
|| || // || ||
n = 2
|| || // || ||
|| || // || ||
n = 3
|| || // || ||
|| || // || ||
|| || // || ||
n = 4
|| || // || ||
|| || // || ||
|| || // || ||
|| || // || ||
n = 5
|| || // || ||
|| || // || ||
|| || // || ||
|| || // || ||
|| || // || ||
and so on.
Input
A single positive integer in any convenient format, n > 0
.
Output
An ASCII-art representation of 11/11
, following the above rules and examples. Leading/trailing newlines or other whitespace are optional, provided that the characters line up appropriately.
Rules
- Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
- Standard loopholes are forbidden.
- This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.
2What the... forget my answer, this is genius. I should stop going the conventional route every single time :P – ETHproductions – 2016-11-11T17:18:12.380
That's slick. Nice answer. – AdmBorkBork – 2016-11-11T17:19:45.613
Can someone explain the
$'
and the `$`` in the regex? I've never seen that before and would love to understand it better. – Robert Hickman – 2016-11-13T23:54:14.9431@RobertHickman They refer to the part of the string after and before the match (
$&
would be the match itself). – Neil – 2016-11-14T00:10:11.543@Neil, thanks! You learn something new everyday :) – Robert Hickman – 2016-11-14T01:31:29.453