Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>Perl, 99 characters</h2> <pre><code>@P=map{$/.substr$".'__/ \\'x99,$_,$W||=1+3*pop}0,(3,6)x pop; chop$P[0-$W%2];print" __"x($W/6),@P </code></pre> <p><strong>Last edit</strong>: Saved one character replacing <code>-($W%2)</code> with <code>0-$W%2</code> (thanks A. Rex)</p> <p><strong>Explanation:</strong></p> <p>For width W and height H, the output is 2+2 * H lines long and 3 * W+1 characters wide, with a lot of repetition in the middle of the output.</p> <p>For convenience, we let <code>$W</code> be 3 * W + 1, the width of the output in characters.</p> <p>The top line consists of the pattern <code>" __"</code>, repeated W/2 == <code>$W/6</code> times.</p> <p>The even numbered lines consist of the repeating pattern <code>"\__/ "</code>, truncated to <code>$W</code> characters. The second line of output is a special case, where the first character of the second line should be a space instead of a <code>\</code>.</p> <p>The odd numbered lines consist of the repeating pattern <code>"/ \__"</code>, truncated to <code>$W</code> characters.</p> <p>We construct a string: <code>" " . "__/ \" x 99</code>. Note that the beginning of this string is the desired output for the second line. This line starting at position 3 is the desired output for the odd lines, and starting at position 6 for the even numbered lines.</p> <p>The LIST argument to the <code>map</code> call begins with 0 and is followed by H repetitions of (3,6). The <code>map</code> call creates a list of the substrings that begin at the appropriate positions and are <code>$W</code> = 3 * W + 1 characters long.</p> <p>There is one more adjustment to make before printing the results. If W is odd, then there is an extra character on the second line (<code>$P[0]</code>) that needs to be <code>chop</code>ped off. If W is even, then there is an extra character on the bottom line (<code>$P[-1]</code>) to chop.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload