Problem

Draw a hexagon chain x long, each with side of y length

Input

x - the length of the chain <= 50

y - the length of each side <= 50

x=1,y=1

_
/ \
\_/

x=4,y=1

_   _
/ \_/ \_
\_/ \_/ \
\_/ \_/

x=3,y=2

__      __
/  \    /  \
/    \__/    \
\    /  \    /
\__/    \__/
\    /
\__/

Rules

• The shortest valid answer in bytes wins.

• Leading and trailing newlines allowed.

• Trailing white space allowed.

• Related – Arnauld Dec 8 '17 at 9:23
• Waiting for obligatory Hexagony answer... – LLlAMnYP Dec 8 '17 at 15:36
• @LLlAMnYP Any minute now... – Martin Ender Dec 8 '17 at 15:43
• @user202729 If you write one now, we never have to find out what happens. – LiefdeWen Dec 27 '17 at 17:00
• First line in Hexagony. Obviously need to increase edge size for the rest. – user202729 Dec 28 '17 at 14:14

Charcoal, 34 bytes

ＮθＦＮ«Ｍ∧﹪ι²⊗θ↓Ｐ×_θ←↖θ→↗θ×_θ↓↘θ←Ｐ↙θ↗

Try it online! Link is to verbose version of code. Takes the parameters in the order size, count. Explanation:

Ｎθ

Input the hexagon size.

ＦＮ«

Loop over the input number of hexagons.

Ｍ∧﹪ι²⊗θ↓

On alternate hexagons, move down a whole hexagon, so that the next hexagon is drawn to the lower right rather than the upper right.

Ｐ×_θ

Draw the bottom.

←↖θ

Draw the lower left side.

→↗θ

Draw the upper left side.

×_θ

Draw the top.

↓↘θ

Draw the upper right side.

←Ｐ↙θ

Draw the lower right side.

Assume the next hexagon is to the upper right.

Python 2, 254 224 bytes

def f(n,w):
a=w*2
for j in range(1+w*3):print''.join([[[' ',[' /'[i%w==-j%w],' \\'[i%w==~-j%w]][i/a+~-j/w&1]][(j>0)*(i/w>=(j>a))*((i/w/n<2)or(n%-2<~-j/w<3-n%2))],' _'[(j+i/w%4/2*w)%a<(i<n*a)]][i/w%2]for i in range(-~n*a)])

Try it online!

Python 2, 264 229 bytes

def f(n,w):
c=2*w;r=[[' ']*(-~n*c)for _ in' '*(1+w*3)]
for i in range(w):
for j in range(n):a=i+j*2*w;b=j%2*w;r[b][w+a],r[c+b][w+i+j*c],r[b+w-i][a],r[b+c-i][a+c],r[b+w-~i][a],r[b-~i][a+c]=r'__//\\'
for l in r:print''.join(l)

Try it online!

• @ovs Thanks a lot :) – TFeld Dec 8 '17 at 14:39
• 222 bytes – FlipTack Dec 25 '17 at 10:08

SOGL V0.12, 32 31 bytes

ā.{e╚øΚe╔*ο⁴↔±┼┼╬±fe«*If2%e*I╬5

Try it Here!

Explanation:

ā                              push an empty array - the canvas
.{                            repeat input times
e╚                            push a diagonal the length of the variable E (by default: next input)
øΚ                          prepend a line to it
e╔*ο                      push ["_"*E]
⁴                     copy that diagonal
↔±                   and reverse it horizontally
┼┼                 add the 3 parts together
╬±               and palindromize vertically - one hexagon is finished
fe«*I          push counter*E*2 + 1 (the counter is 0-based)
f2%e*I    push counter%2 * E + 1
╬5  at [counter*E*2+1; counter%2*E+1] insert the hexagon in the canvas

Befunge, 230228 225 bytes

+&#92#<*:0< vp93*p92+1*3:p91:&+1p
>1+:29g-!#@_>:1-19g+:19g/1-:2*49p2%!2*:1+59p19g*\19g%+69p01v
,>*19g3*79g-1-69g-!2*49g1+0g2%*79g69g-!49g0g2%*++4g,1+:39g-v
^^3*!-*g95g91+1g96!-g95%4p04p01:\g90p050::/g91:p97%*4g91:_\$55+
\/_

Try it online!

JavaScript (ES6), 215 bytes

Takes input in currying syntax (y)(x).

y=>(F=(x,c=!(p=y-1,w=x*y*2+y,a=[...(' '.repeat(w++)+
).repeat(3*y+1)],g=(d,k)=>k!=y?g(d,-~k,a[p+=d]='_\\/'[c%3]):c++))=>x--?F(x,g(1),g(w+1),p++,g(w-1),g(-1),p+=w,g(~w),p--,g(1-w),p+=(c/6&1?w:-w)*y-w+y*2):a.join)

Demo

let f =

y=>(F=(x,c=!(p=y-1,w=x*y*2+y,a=[...(' '.repeat(w++)+
).repeat(3*y+1)],g=(d,k)=>k!=y?g(d,-~k,a[p+=d]='_\\/'[c%3]):c++))=>x--?F(x,g(1),g(w+1),p++,g(w-1),g(-1),p+=w,g(~w),p--,g(1-w),p+=(c/6&1?w:-w)*y-w+y*2):a.join)

O.innerText = f(3)(7)
<pre id=O></pre>

Canvas, 25 bytes

ø╶｛╷⁷«×¹２％⁷×╵⁷⇵_× ⁷／∔×╬│╋

Try it here!

Explanation (some characters have been changed to look monospace):

ø╶{╷⁷«×¹2%⁷×╵⁷⇵_× ⁷/∔×╬│╋
ø                          push an empty canvas
╶{                        for 1..input
╷                         decrease (so this starts with 0)
⁷«×                      multiply by X*2; X coordinate of new hexagon done
¹2%                   push 0-indexed counter%2
⁷×                 multiply by X
╵                and increment; Y coordinate done
⁷⇵              push ceil(X/2), saving the remainder
_×            repeat "_" that many times
⁷/         push " " and an ASCII diagonal with size X
∔        prepend verticall the space before the diagonal
done so there's space for the underscores
×       and append the underscores horizontally to the diagonal
╬│     quad-palindromize with Y overlap of 1
and X overlap of the remainder taken before
╋    and at the before defined coords ((I-1)*X*2; (i%2)*X + 1)
insert the hexagon in the canvas