Note that there are some explanatory texts on larger screens.

plurals
  1. POCode Golf: Beehive
    text
    copied!<h2>The challenge</h2> <p>The shortest code by character count that will generate a beehive from user input.</p> <p>A beehive is defined a a grid of hexagons in a size inputted by the user as two positive numbers greater than zero (no need to validate input). The first number (<code>W</code>) represents the width of the beehive - or - how many hexagons are on each row. The second number (<code>H</code>) represents the height of the beehive - or - how many hexagons are on each column.</p> <p>A Single hexagon is made from three ASCII characters: <code>_</code>, <code>/</code> and <code>\</code>, and three lines:</p> <pre><code> __ / \ \__/ </code></pre> <p>Hexagons complete each other: the first column of the beehive will be 'low', and the second will be high - alternating and repeating in the same pattern forming W hexagons. This will be repeated H times to form a total of WxH hexagons.</p> <h2>Test cases:</h2> <pre><code>Input: 1 1 Output: __ / \ \__/ </code></pre> <hr> <pre><code>Input: 4 2 Output: __ __ __/ \__/ \ / \__/ \__/ \__/ \__/ \ / \__/ \__/ \__/ \__/ </code></pre> <hr> <pre><code>Input: 2 5 Output: __ __/ \ / \__/ \__/ \ / \__/ \__/ \ / \__/ \__/ \ / \__/ \__/ \ / \__/ \__/ </code></pre> <hr> <pre><code>Input: 11 3 Output: __ __ __ __ __ __/ \__/ \__/ \__/ \__/ \__ / \__/ \__/ \__/ \__/ \__/ \ \__/ \__/ \__/ \__/ \__/ \__/ / \__/ \__/ \__/ \__/ \__/ \ \__/ \__/ \__/ \__/ \__/ \__/ / \__/ \__/ \__/ \__/ \__/ \ \__/ \__/ \__/ \__/ \__/ \__/ </code></pre> <hr> <p>Code count includes input/output (i.e full program).</p>
 

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