Overview
Given a number of hexagons, arrange them into a connected shape within the confines of a 50 by 50 ASCII art image. The shape you choose can be arbitrary - whatever you find most amenable to golfing - as long as it is connected. It may have holes provided they are larger than one hexagon (otherwise the number of hexagons will be ambiguous).
Layout
All hexagons must be in the following form (only this size and orientation is valid):
__
/ \
\__/ Note there are 2 underscores per horizontal edge.
Two hexagons are directly connected if they share an edge:
__ __
/ \__ / \
\__/ \ \__/
\__/ or / \
\__/
Two hexagons are not connected if they only share a vertex:
__ __
/ \/ \
\__/\__/
Sharing half an edge also does not count as connected:
__
/ \
\__/
/ \
\__/
A collection of hexagons is connected if there exists a path from any hexagon to any other using only directly connected hexagons.
Holes
A hexagon sized hole in a connected collection of hexagons counts as a hexagon, so that any given piece of ASCII art has an unambiguous hexagon count.
This does not count as a hole since the prospective hole is a single hexagon:
__
__/ \__
/ \__/ \
\__/ \__/
/ \__/ \
\__/ \__/
\__/ 7 hexagons (not 6 with a hole)
This does count as a hole since it does not correspond to a single hexagon:
__
__/ \__
/ \__/ \__
\__/ \__/ \
/ \__ \__/
\__/ \__/ \
\__/ \__/
\__/ 8 hexagons with a hole
Input and output
Input
An integer from 1 to 255.
Output
An ASCII art string representing the input number of connected hexagons as described above.
- The number of rows (newline separated substrings) is at most 50, plus an additional optional trailing newline.
- The rows need not be the same length, but each must be of length at most 50.
- Zero length rows can exist above or below the connected shape provided the total number of rows does not exceed 50.
- Space-only rows can exist above or below the connected shape provided the total number of rows does not exceed 50.
- Spaces can appear to the left of the shape provided the row lengths do not exceed 50 (the shape does not need to be aligned to the left).
- Spaces can appear to the right of the shape provided the row lengths do not exceed 50.
- Any characters that do not form part of the connected shape must be either spaces or newlines.
Provided the output is correct, it is not required to be consistent from one run to the next.
Examples
Input: 6
Valid Outputs:
__ __ __
/ \__/ \__/ \__
\__/ \__/ \__/ \
\__/ \__/ \__/
__ __
/ \__/ \
\__/ \__/
/ \__/ \
\__/ \__/
\__/
__
__ / \
/ \__ \__/
\__/ \__/ \
\__/ \__/
\__/
/ \
\__/
Invalid Outputs:
__
__/ \__
/ \__/ \
\__/ \__/
/ \__/ \
\__/ \__/
\__/ Invalid for 6 as the centre hole counts as a 7th hexagon.
__ __ __ __
/ \__/ \__/ \ / \
\__/ \__/ \__/ \__/
\__/ \__/ Invalid as the 6 hexagons are not connected.
__ __ __ __
/ \__/ \__/ \/ \
\__/ \__/ \__/\__/
\__/ \__/ Invalid as vertex touching does not count as connected.
__ __ __
/ \__/ \ / \
\__/ \__/ \__/
/ \__/ \
\__/ \__/
\__/ Invalid as the 6 connected hexagons are not the only visible characters.
Winning
The shortest valid answer in bytes wins.
Leaderboard
(using Martin's leaderboard snippet)
var QUESTION_ID=54277;function answersUrl(e){return"http://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),e.has_more?getAnswers():process()}})}function shouldHaveHeading(e){var a=!1,r=e.body_markdown.split("\n");try{a|=/^#/.test(e.body_markdown),a|=["-","="].indexOf(r[1][0])>-1,a&=LANGUAGE_REG.test(e.body_markdown)}catch(n){}return a}function shouldHaveScore(e){var a=!1;try{a|=SIZE_REG.test(e.body_markdown.split("\n")[0])}catch(r){}return a}function getAuthorName(e){return e.owner.display_name}function process(){answers=answers.filter(shouldHaveScore).filter(shouldHaveHeading),answers.sort(function(e,a){var r=+(e.body_markdown.split("\n")[0].match(SIZE_REG)||[1/0])[0],n=+(a.body_markdown.split("\n")[0].match(SIZE_REG)||[1/0])[0];return r-n});var e={},a=1,r=null,n=1;answers.forEach(function(s){var t=s.body_markdown.split("\n")[0],o=jQuery("#answer-template").html(),l=(t.match(NUMBER_REG)[0],(t.match(SIZE_REG)||[0])[0]),c=t.match(LANGUAGE_REG)[1],i=getAuthorName(s);l!=r&&(n=a),r=l,++a,o=o.replace("{{PLACE}}",n+".").replace("{{NAME}}",i).replace("{{LANGUAGE}}",c).replace("{{SIZE}}",l).replace("{{LINK}}",s.share_link),o=jQuery(o),jQuery("#answers").append(o),e[c]=e[c]||{lang:c,user:i,size:l,link:s.share_link}});var s=[];for(var t in e)e.hasOwnProperty(t)&&s.push(e[t]);s.sort(function(e,a){return e.lang>a.lang?1:e.lang<a.lang?-1:0});for(var o=0;o<s.length;++o){var l=jQuery("#language-template").html(),t=s[o];l=l.replace("{{LANGUAGE}}",t.lang).replace("{{NAME}}",t.user).replace("{{SIZE}}",t.size).replace("{{LINK}}",t.link),l=jQuery(l),jQuery("#languages").append(l)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",answers=[],page=1;getAnswers();var SIZE_REG=/\d+(?=[^\d&]*(?:<(?:s>[^&]*<\/s>|[^&]+>)[^\d&]*)*$)/,NUMBER_REG=/\d+/,LANGUAGE_REG=/^#*\s*([^,]+)/;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"><div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table></div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table></div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody></table><table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody></table>
6 Answers 6
CJam, (削除) 64 (削除ここまで) (削除) 57 (削除ここまで) 55 bytes
" __
/ \
\__/"N/{_SS/\+_47>S3*f{\+}_2>\@?}q~(*]:..e>N*
This will generate the following pattern, column-wise:
__ __ __ __ __ __
/ \__/ \__/ \__/ \__/ \__/ \
\__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \
\__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \
\__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \
\__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \
\__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \
\__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \
\__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \
\__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \
\__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \
\__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \
\__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \
\__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \
\__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \
\__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \
\__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \
\__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \
\__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \
\__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \
\__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \
\__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/ \
/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/ \
/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/ \
/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/
Explanation
This is based on Dennis's excellent tip, using .e>
to assemble an ASCII art output from several pieces. As he says, .e>
takes the element-wise maximum of two arrays (or strings), and since spaces have the lowest character code, we can use this to impose any other characters on a string grid. Furthermore, if the two arrays don't have the same length, the extraneous elements of the longer array are simply copied unchanged. This means that the different patterns don't even need to be the same size. To apply this to two-dimensional arrays (because we don't want to insert the newlines until the very end), we apply .e>
pairwise to lines, which gives ..e>
.
The basic idea of the code is to generate N
copies of a single hexagon moved to the right position. We "move" the hexagon vertically by prepending empty lines and horizontally by prepending spaces. Once we're done, we fold all of the copies together, using the beautiful :..e>
(probably the longest operator I've ever used in a CJam program).
Here is the code:
" __
/ \
\__/"N/ e# Get a 2D character grid of the hexagon.
{ e# Read input N, repeat this block N-1 times.
_ e# Make a copy, so we leave the last hexagon on the stack.
SS/\+ e# Prepend two empty lines.
_47> e# Make a copy and discard the first 47 lines.
S3*f{\+} e# Prepend 3 spaces to each line. This copy has been moved back to
e# the top and one column to the right.
_2> e# Make a copy and discard another two lines.
\@? e# If any lines were left after that, pick the copy in the next column,
e# otherwise, stay in the same column.
}q~(*
]:..e> e# Wrap all the hexagons in an array and fold them into a single grid.
N* e# Join them with newline characters.
-
\$\begingroup\$ Man, I really ought to learn one of these golfing languages. \$\endgroup\$Alex Van Liew– Alex Van Liew2015年08月05日 23:26:17 +00:00Commented Aug 5, 2015 at 23:26
-
\$\begingroup\$ @AlexVanLiew You should! :) But not because it improves your chances of winning code golf, but because CJam is a beautiful language which is fun to program in, and I don't know any other language in which the above solution (which I think is quite elegant) would have made sense. ;) \$\endgroup\$Martin Ender– Martin Ender2015年08月06日 13:59:35 +00:00Commented Aug 6, 2015 at 13:59
-
\$\begingroup\$ I'd probably learn Pyth or both; are they both pretty much the same thing or is one better than the rest? \$\endgroup\$Alex Van Liew– Alex Van Liew2015年08月06日 16:23:41 +00:00Commented Aug 6, 2015 at 16:23
-
\$\begingroup\$ @AlexVanLiew I don't know much Pyth, but I know that they are far from the same thing. CJam is a stack-based language, while Pyth originated as a shorthand for Python (but now has its own set of built-ins). Pyth might slightly have the upper hand when it comes to golfing, but I personally really enjoy programming in a different paradigm, so I'll stick with CJam. \$\endgroup\$Martin Ender– Martin Ender2015年08月06日 16:26:26 +00:00Commented Aug 6, 2015 at 16:26
-
\$\begingroup\$ Aha, I see. I know Python pretty well, which is why I'd like to learn Pyth, but if I get the time maybe I'll give CJam a try too! \$\endgroup\$Alex Van Liew– Alex Van Liew2015年08月06日 18:07:14 +00:00Commented Aug 6, 2015 at 18:07
Python 2, (削除) 219 (削除ここまで) 207 chars
b=bytearray(' ');h=['__ ','/ \\','\\__/'];k=range;x=input();g=[b*50for _ in k(50)]
for i in k(x):
c=i*3%48+1;r=(i*3+1)/48*2+i%2
for m in k(i>15,3):n=m==0;g[r+m][c+n:c+4-n]=h[m]
print"\n".join(map(str,g))
Takes input on stdin.
Pretty much just creates a 50x50 grid of spaces of and plops the hexagons in where appropriate. After the 16th hexagon, I don't need the first row of h
(the hexagon as a 2D array) so I use i>15
to start the range at 1 instead of 0. c=i*3%48+1;r=(i*3+1)/48*2+i%2
calculates the column and row I need to start at. n
is a boolean but is used as an integer to fix up the bounds (since h[0]
is only 3 characters to avoid overwriting stuff).
I'm pretty happy with this one, I shaved off about 50 bytes since the initial version, especially when I remembered the a[x:y]=b
syntax.
Output (n=30):
__ __ __ __ __ __ __ __
/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \
/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \
\__/ \__/ \__/ \__/ \__/ \__/ \__/
(plus 44 lines of spaces each 50 wide)
Since trailing lines of whitespace are allowed I changed the creation of g
to just create 50 bytearray
s instead of 3+(x>1)+x/16*2
, which is the exact number of rows required, shaving off 12 bytes.
Swift 2.0, (削除) 601 (削除ここまで) 591 bytes
import Cocoa
var a=Int(Process.arguments[1])!,b="/ \\__".join([String](count:9,repeatedValue:""))+"/",c="\\__/ ".join([String](count:9,repeatedValue:""))+"\\",d=c.startIndex,e=c.endIndex,j=[c.stringByReplacingOccurencesOfString("\\",withString:" ").stringByReplacingOccurencesOfString("/",withString:" ").substringToIndex(advance(d,3*a,e)),b.substringToIndex(advance(d,3*a+a%2,advance(e,-1)))]
while a>0{j+=[c.substringToIndex(advance(d,3*a+1,e)),b.substringToIndex(advance(d,3*a+(a+1)%2,e)]
a<=16 ?j+=[" "+j.removeLast().substringFromIndex(advance(d,1))]:()
a-=16}
for l in j{print(l)}
To run: swift hexagons.swift 21
Output:
__ __ __ __ __ __ __ __
/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \
/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/
\__/ \__/
Swift's substringToIndex
and stringByReplacingOccurencesOfString
take up so many characters...
-
\$\begingroup\$ I don't know Swift at all, but isn't there a way to construct that repetitive string with less code? \$\endgroup\$Reto Koradi– Reto Koradi2015年08月05日 15:51:09 +00:00Commented Aug 5, 2015 at 15:51
-
\$\begingroup\$ The only way I know of to repeat a string is with
stringByPaddingToLength
, however in this case it would be 11 characters longer than typing out the full string. \$\endgroup\$David Skrundz– David Skrundz2015年08月05日 16:05:53 +00:00Commented Aug 5, 2015 at 16:05 -
6\$\begingroup\$ I see Apple really likes overly verbose string concatenation. Not as bad as
stringByAppendingString
in Objective-C but still... \$\endgroup\$Fatalize– Fatalize2015年08月05日 16:30:34 +00:00Commented Aug 5, 2015 at 16:30 -
1\$\begingroup\$ Outside of code golf this is really nice though as it makes searching for a method so much easier. \$\endgroup\$JustSid– JustSid2015年08月06日 13:24:12 +00:00Commented Aug 6, 2015 at 13:24
C, 238 bytes
#define h(A) c[m+A/4][n+A%4]
i,m,n;
f(a)
{
char c[50][51];
for(i=0;i<50;i++)for(m=0;m<51;m++)c[i][m]=m-50?32:0;
for(;a;)
m=a/12*2,n=a%12*3,a--%2?m=a/12*2+1,n=a%12*3+3:0,
h(1)=h(2)=h(9)=h(10)=95,h(4)=h(11)=47,h(7)=h(8)=92;
for(;i;)puts(c-i--+50);
}
Only necessary spaces and newlines considered for character count.
It simply creates a matrix of characters, fills them in reverse order, and then prints the whole thing.
-
\$\begingroup\$ 233 bytes \$\endgroup\$ceilingcat– ceilingcat2020年06月09日 02:05:30 +00:00Commented Jun 9, 2020 at 2:05
JavaScript (ES6), 265 bytes
A=Array;f='forEach';U=x=1;y=0;a=A.from(A(51),_=>A.from(A(51),_=>' '));d=h=>(` __
/ \\
\\__/`.split`
`[f]((l,i)=>[...l][f]((c,j)=>{if('_/\\'.indexOf(a[x+i][y+j])<0)a[x+i][y+j]=c})),(x+=U*-2+1),(U=!U),(C-y<=3?((U=x+=2),y=0):y+=3),--h?d(h):a.map(d=>d.join``).join`
`)
Tessellates hexagons in a row, from left to right, alternating up and down—like a honeycomb—until the end of a row is reached.
Ungolfed with description (works in firefox):
'use strict';
const CAP = 51;
var a = Array.from(Array(51), () => Array.from(Array(51),() => ' '))
function draw (hexagons, x, y, a, up) {
// x, y (row, col) represents the current position of the cursor
/*
Here's a map of the first three iterations:
01234567
0 __
1 __/ \__
2 / \__/ \
3 \__/ \__/
For the first 17 iterations, the cursor will be at:
# | x | y
----------
1 | 1 | 0
2 | 0 | 3
3 | 1 | 6
4 | 0 | 9
5 | 1 | 12
6 | 0 | 15
7 | 1 | 18
8 | 0 | 21
9 | 1 | 24
10 | 0 | 27
11 | 1 | 30
12 | 0 | 33
13 | 1 | 36
14 | 0 | 39
15 | 1 | 42
16 | 0 | 45
17 | 3 | 0 <- moves back to the first row
*/
` __
/ \\
\\__/`
// split the hexagon into three lines
.split('\n').forEach((line, index) => {
// and for each line
;[...line].forEach((char, j) => {
// if the cursor position (x, y) translated
// by (index, j) is not already part of a hexagon
// then replace it with the current (index, j) piece
// of the hexagon
/*
0123
0 __
1 / \
2 \__/
*/
if ('_/\\'.indexOf(a[x + index][y + j]) < 0)
a[x + index][y + j] = char
})
})
// `up` represents the next hexagon
// if true, the next hexagon will be drawn attached to
// the top right edge of the current hexagon
if (up) {
x -= 1
// otherwise, it'll be drawn attached to the bottom right edge
} else {
x += 1
}
// move three columns to the right
y += 3
// change directions
up = !up
// if within the right boundary of the 51x51 matrix,
// move back to the left edge and down 2 rows
// and draw the next hexagon as an `up` hexagon
if (51 - y <= 3) {
y = 0
x += 2
up = true
}
// if hexagons > 0, then recurse and draw the next hexagon
// otherwise, return the array (join the columns in each row, then join each row
// by a new line)
return --hexagons ?
draw(hexagons, x, y, a, up)
: a.map(d => d.join('')).join('\n')
}
var n = parseInt(prompt('Number to draw:'))
var r = draw(n, 1, 0, a, true)
document.write('<pre>' + r.replace(/\n/g, '<br>') + '</pre>')
Ruby, 120
->n{a=(1..50).map{' '*50}
n.times{|i|x=i%16*3
3.times{|j|a[47-i/16*2-x/3+j][x..x+3]=[' __ ','/ \\','\__/'][j]}}
puts a}
creates an array of 50 strings of 50 spaces, then substitutes 4 characters in 3 lines to add the hexagons:
" __ "
"/ \"
"\__/"
As the first line contains spaces, once a hexagon has been plotted we cannot plot another one below it, because the spaces would overwrite the previous hexagons.
Therefore the hexagons are added in the form of a 16x16 rhombus (distorted rectangle) from bottom to top, and slanting from bottom left to top right.
The string " __ "
will then be overwritten with additional \
and /
where neccessary.
Ungolfed in test program
g=->n{
a=(1..50).map{' '*50} #make an array of 50 strings of 50 spaces
n.times{|i| #loop through all hexagons
x=i%16*3 #x coordinate of top left corner of hexagon, 16 per row
3.times{|j| #loop through 3 lines to print hexagon.
a[47-i/16*2-x/3+j][x..x+3]= #47-i/16*2 : start at the bottom and work up. each row is 2 lines high and contains 16 hexagons. x/3 : slant upwards as the row moves right.
[' __ ','/ \\','\__/'][j] #These are the symbols for each of the 3 lines required for a hexagon. [x..x+3] defines which characters have to be replaced in each string.
}
}
puts a #print to stdout
}
N=gets.to_i
g.call(N)
Typical output (n=250)
There should be a few more rows of whitespace at the top here, to make a total of 50, but I don't know if there is a way to get Stackexchange to format to include them.
__
__/ \
__/ \__/
__/ \__/ \
__ __/ \__/ \__/
__/ \__/ \__/ \__/ \
__/ \__/ \__/ \__/ \__/
__/ \__/ \__/ \__/ \__/ \
__/ \__/ \__/ \__/ \__/ \__/
__/ \__/ \__/ \__/ \__/ \__/ \
__/ \__/ \__/ \__/ \__/ \__/ \__/
__/ \__/ \__/ \__/ \__/ \__/ \__/ \
__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \
/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \
/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \
/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \
/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \
/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \
/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \
/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \
/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \
/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/
\__/ \__/ \__/ \__/
/ \__/ \__/ \__/
\__/ \__/ \__/
/ \__/ \__/
\__/ \__/
/ \__/
\__/
Explore related questions
See similar questions with these tags.
6
. For an input of255
a horizontal row of hexagons won't fit in a 50 by 50 ASCII art. \$\endgroup\$