Skip to main content
The 2024 Developer Survey results are live! See the results
57 votes

Triangular Lattice Points close to the Origin

Python 2, 43 bytes f=lambda n,a=1:n*n<a/3or n*n/a*6-f(n,a+a%3) Try it online! This is black magic. Offering 250 rep for a written-up proof. See Lynn's ...
xnor's user avatar
  • 146k
46 votes

Snowman Bowling

Snowman 1.0.2, 157 bytes ...
Doorknob's user avatar
  • 71.5k
41 votes

Could you make me a hexagon please?

Hexagony + Bash Coreutils, 0+3+8 = 11 Bytes Includes +3 for -g flag and +8 for |tr . \* non-standard invocation (see this meta ...
Riley's user avatar
  • 11.7k
39 votes

Hexagonal maze time!

Hexagony, 2437 bytes The long-awaited program is here: ...
boboquack's user avatar
  • 2,317
34 votes

Triangular Lattice Points close to the Origin

Haskell, 48 bytes f n=1+6*sum[(mod(i+1)3-1)*div(n^2)i|i<-[1..n^2]] Try it online! Uses xnor's "black magic" formula: $$f(n)=1+6\sum_{a=0}^\infty \...
lynn's user avatar
  • 68.9k
30 votes

Triangular Lattice Points close to the Origin

Wolfram Language (Mathematica), 53 51 50 bytes -1 byte thanks to @miles Sum[Boole[x(x+y)+y^2<=#^2],{x,-2#,2#},{y,-2#,2#}]& Try it online! How? Instead of ...
JungHwan Min's user avatar
  • 13.8k
24 votes

Sticky polyhexes

Haskell, 320…236 230 bytes ...
Delfad0r's user avatar
  • 6,276
23 votes
Accepted

A spiral sequence

JavaScript (ES6),  267 .. 206  199 bytes Returns an array containing the \$N\$ first terms of the sequence. ...
Arnauld's user avatar
  • 194k
20 votes

Could you make me a hexagon please?

Python 2, 61 bytes i=n=input() while~-n+i:i-=1;j=abs(i);print' '*j+'* '*(2*n+~j) Prints a trailing space at the end of each line. Thanks to Erik the Outgolfer ...
xnor's user avatar
  • 146k
20 votes

Counting creatures on a hexagonal tiling

JavaScript (Node.js),  578 ... 433  431 bytes ...
Arnauld's user avatar
  • 194k
19 votes

HexaGolf: Wordagons

Python 2, 83 bytes s=input() l=len(s) while 1:l-=1;y=abs(l);print' '*y+' '.join(s[:y:-1]+s[y]*y+s[y:]) Prints the wordagon and then crashes (which only prints to ...
lynn's user avatar
  • 68.9k
19 votes

Stack the rocks

Ruby, 124 117 112 110 bytes ...
Level River St's user avatar
18 votes

HexaRegex: A Tribute to Martin Ender

Retina, 744 bytes Sorry folks, no Hexagony this time... Byte count assumes ISO 8859-1 encoding. ...
Martin Ender's user avatar
16 votes
Accepted

Cut a triangle into equal-sized parts!

JavaScript (ES7),  367 362 359  357 bytes Saved 1 byte thanks to @Shaggy Expects (n)(m). ...
Arnauld's user avatar
  • 194k
15 votes

Hexplosive ASCII-art challenge

JavaScript (ES6), 118 117 bytes ...
Neil's user avatar
  • 173k
15 votes

Could you make me a hexagon please?

Hexagony, 91 87 86 bytes ?{2'*=&~}=&}='P0</0P}|@..;>;'.\};0Q/..\&(<>"-_"&}=\?_&\/8.=-\<><;{M/.(.(/.-{><.{&'/_.\ ...
DELETE_ME's user avatar
  • 17.3k
14 votes

HexaGolf: Rotatagons

Python 2, 160 158 156 148 124 bytes Prepare to be amazed! The resulting text is drawn on a canvas... by a Turtle! :D ...
mbomb007's user avatar
  • 23.4k
13 votes

HexaRegex: A Tribute to Martin Ender

Python 3, 990 943 770 709 bytes First answer, yay! EDIT: Golfed adjacency list making. I now use a slightly different formula EDIT 2: Removed unnecessary fluff, golfed a lot more. EDIT 3: ...
Blue's user avatar
  • 2,036
13 votes

Could you make me a hexagon please?

JavaScript (ES6), 77 81 84 @Upvoters: don't miss the answer by @ETHproductions, that is 76 bytes Edit Revised after change in spec, trailing space allowed Just for the hat ... hey! No hat? ...
edc65's user avatar
  • 32.2k
13 votes

Halting Problem for Simplified Hexagony

APL (Dyalog Unicode), 616 bytesSBCS ...
Bubbler's user avatar
  • 77.8k
12 votes

Could you make me a hexagon please?

JavaScript (ES6), 77 76 bytes g=(n,s=` *`+' *'.repeat(n*2-2),c=s,q=c.replace('*',''))=>--n?g(n,q+s+q,q):s I told myself I wouldn't sleep until I had set a new ...
ETHproductions's user avatar
12 votes

Totally random Catan number distributions

JavaScript (ES6), 162 bytes ...
Arnauld's user avatar
  • 194k
11 votes
Accepted

Hexplosive ASCII-art challenge

MATL, 39 37 bytes 4*3-:!G:+o~YRtP*!tPw4LY)vtI5&lZ+47+*c Try it online! Or verify all test cases. Explanation I get to use convolution again! Consider input <...
Luis Mendo's user avatar
  • 105k
11 votes

Could you make me a hexagon please?

C, 91 89 80 74 bytes w,y;f(s){for(y=-s;++y<s;)for(w=printf("\n%*s",y,"");++w<s*printf(" *"););} I pretty much tweaked around to ...
Quentin's user avatar
  • 1,187
11 votes

Working on my Knight moves

JavaScript (ES6), 184 bytes Takes the file F as a character and the rank R as an integer in currying syntax ...
Arnauld's user avatar
  • 194k
11 votes
Accepted

Hexagonal Triangles!

Charcoal, 62 43 39 bytes NβF³«F⁻β‹ι²« / \¶| |¶ \ /Mײι↑¿⁻¹ιM⁶← Try it online! Edit: Saved some bytes thanks to @ASCII-only (not sure exactly how many as I also ...
Neil's user avatar
  • 173k
11 votes

ASCII Rubik's Cube

Charcoal, 28 23 bytes F³⁺⁺×\_³×\/⁻³ι¶ ‖M↑×_ ³ Try it online! Link is to verbose version of code. Not very Charcoal-y I know. I didn't realise that ...
Neil's user avatar
  • 173k
11 votes

Cut a triangle into equal-sized parts!

Scala 3, 526...358 357 bytes ...
user's user avatar
  • 357
10 votes

HexaGolf: Wordagons

Vim, 92 bytes :se ri|s/./ &/g ⓋCⓇ"Ⓓ␛$vpmlmrqqYpi ␛`ljxxhmlylv`rjlmr:s/\%V\(.\)./Ⓡ" /g @qq@qVdy2G:g/^/m0 Gp Circled letters represent Control + letter; ␛ is ...
lynn's user avatar
  • 68.9k
10 votes

Snowman Bowling

stacked, noncompeting, 118 bytes I added deepmap and a few other things after this challenge, along with tons of bugfixes. Try it here! ...
Conor O'Brien's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible