Note that there are some explanatory texts on larger screens.

plurals
  1. POCode Golf: Build Me an Arc
    text
    copied!<h2>Challenge</h2> <p>The shortest program by character count that accepts standard input of the form <code>X-Y R</code>, with the following guarantees:</p> <ul> <li><code>R</code> is a non-negative decimal number less than or equal to 8</li> <li><code>X</code> and <code>Y</code> are non-negative angles given in decimal as multiples of 45&deg; (<code>0</code>, <code>45</code>, <code>90</code>, <code>135</code>, etc.)</li> <li><code>X</code> is less than <code>Y</code></li> <li><code>Y</code> is not <code>360</code> if <code>X</code> is <code>0</code></li> </ul> <p>And produces on standard output an ASCII "arc" from the starting angle <code>X</code> to the ending angle <code>Y</code> of radius <code>R</code>, where:</p> <ul> <li>The vertex of the arc is represented by <code>o</code></li> <li>Angles of <code>0</code> and <code>180</code> are represented by <code>-</code></li> <li>Angles of <code>45</code> and <code>225</code> are represented by <code>/</code></li> <li>Angles of <code>90</code> and <code>270</code> are represented by <code>|</code></li> <li>Angles of <code>135</code> and <code>315</code> are represented by <code>\</code></li> <li>The polygonal area enclosed by the two lines is filled with a non-whitespace character.</li> </ul> <p>The program is not required to produce meaningful output if given invalid input. Solutions in any language are allowed, except of course a language written specifically for this challenge, or one that makes unfair use of an external utility. Extraneous horizontal and vertical whitespace <em>is</em> allowed in the output provided that the format of the output remains correct.</p> <p><strong>Happy golfing!</strong></p> <h2>Numerous Examples</h2> <p>Input:</p> <pre>0-45 8</pre> <p>Output:</p> <pre> / /x /xx /xxx /xxxx /xxxxx /xxxxxx /xxxxxxx o-------- </pre> <p>Input:</p> <pre>0-135 4</pre> <p>Output:</p> <pre> \xxxxxxxx \xxxxxxx \xxxxxx \xxxxx o---- </pre> <p>Input:</p> <pre>180-360 2</pre> <p>Output:</p> <pre> --o-- xxxxx xxxxx </pre> <p>Input:</p> <pre>45-90 0</pre> <p>Output:</p> <pre>o</pre> <p>Input:</p> <pre>0-315 2</pre> <p>Output:</p> <pre> xxxxx xxxxx xxo-- xxx\ xxxx\ </pre>
 

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