Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 1 character in body
Source Link
Erik the Outgolfer
  • 40.8k
  • 5
  • 46
  • 125

Jelly, 24 bytes

R+’μạṀx@6ドルżx@K\€"*$F€ŒḄY

Try it online! Try it online!

Jelly is ashamed of the fact that it does not have a centralization atom, so it's beaten by 05AB1E and V. By 11 and 7 bytes respectively!

If you find any way to golf this, please comment. Any help is appreciated.

Explanation:

R+’μạṀx@6ドルżx@K\€"*$F€ŒḄY Main link. Arguments: z.
R+’ The sizes of the hexagon's rows. (implicit argument)
 μ Start a new monadic chain with the above argument.
 ȧṀx@6ドル The spaces you must prepend to each row. (implicit argument)
 x@K\€"*$ The stars (points) of each row, space-joined, as a single link. (implicit argument)
 ż F€ Conjoin and merge the leading spaces with the stars appropriately.
 ŒḄ Create the second half of the hexagon without the middle row.
 Y Join the rows with newlines. This makes the shape look like a hexagon.

Bonus: To find how many stars are there in a hexagon, use this:

×ばつ6S‘

Jelly, 24 bytes

R+’μạṀx@6ドルżx@K\€"*$F€ŒḄY

Try it online!

Jelly is ashamed of the fact that it does not have a centralization atom, so it's beaten by 05AB1E and V. By 11 and 7 bytes respectively!

If you find any way to golf this, please comment. Any help is appreciated.

Explanation:

R+’μạṀx@6ドルżx@K\€"*$F€ŒḄY Main link. Arguments: z.
R+’ The sizes of the hexagon's rows. (implicit argument)
 μ Start a new monadic chain with the above argument.
 ȧṀx@6ドル The spaces you must prepend to each row. (implicit argument)
 x@K\€"*$ The stars (points) of each row, space-joined, as a single link. (implicit argument)
 ż F€ Conjoin and merge the leading spaces with the stars appropriately.
 ŒḄ Create the second half of the hexagon without the middle row.
 Y Join the rows with newlines. This makes the shape look like a hexagon.

Jelly, 24 bytes

R+’μạṀx@6ドルżx@K\€"*$F€ŒḄY

Try it online!

Jelly is ashamed of the fact that it does not have a centralization atom, so it's beaten by 05AB1E and V. By 11 and 7 bytes respectively!

If you find any way to golf this, please comment. Any help is appreciated.

Explanation:

R+’μạṀx@6ドルżx@K\€"*$F€ŒḄY Main link. Arguments: z.
R+’ The sizes of the hexagon's rows. (implicit argument)
 μ Start a new monadic chain with the above argument.
 ȧṀx@6ドル The spaces you must prepend to each row. (implicit argument)
 x@K\€"*$ The stars (points) of each row, space-joined, as a single link. (implicit argument)
 ż F€ Conjoin and merge the leading spaces with the stars appropriately.
 ŒḄ Create the second half of the hexagon without the middle row.
 Y Join the rows with newlines. This makes the shape look like a hexagon.

Bonus: To find how many stars are there in a hexagon, use this:

×ばつ6S‘
added 736 characters in body
Source Link
Erik the Outgolfer
  • 40.8k
  • 5
  • 46
  • 125

Jelly, 24 bytes

R+’μạṀx@6ドルżx@K\€"*$F€ŒḄY

Try it online!

Jelly is ashamed of the fact that it does not have a centralization atom, so it's beaten by 05AB1E and V. By 11 and 7 bytes respectively!

If you find any way to golf this, please comment. Any help is appreciated.

Explanation:

R+’μạṀx@6ドルżx@K\€"*$F€ŒḄY Main link. Arguments: z.
R+’ The sizes of the hexagon's rows. (implicit argument)
 μ Start a new monadic chain with the above argument.
 ȧṀx@6ドル The spaces you must prepend to each row. (implicit argument)
 x@K\€"*$ The stars (points) of each row, space-joined, as a single link. (implicit argument)
 ż F€ Conjoin and merge the leading spaces with the stars appropriately.
 ŒḄ Create the second half of the hexagon without the middle row.
 Y Join the rows with newlines. This makes the shape look like a hexagon.

Jelly, 24 bytes

R+’μạṀx@6ドルżx@K\€"*$F€ŒḄY

Try it online!

Jelly is ashamed of the fact that it does not have a centralization atom, so it's beaten by 05AB1E and V. By 11 and 7 bytes respectively!

If you find any way to golf this, please comment. Any help is appreciated.

Jelly, 24 bytes

R+’μạṀx@6ドルżx@K\€"*$F€ŒḄY

Try it online!

Jelly is ashamed of the fact that it does not have a centralization atom, so it's beaten by 05AB1E and V. By 11 and 7 bytes respectively!

If you find any way to golf this, please comment. Any help is appreciated.

Explanation:

R+’μạṀx@6ドルżx@K\€"*$F€ŒḄY Main link. Arguments: z.
R+’ The sizes of the hexagon's rows. (implicit argument)
 μ Start a new monadic chain with the above argument.
 ȧṀx@6ドル The spaces you must prepend to each row. (implicit argument)
 x@K\€"*$ The stars (points) of each row, space-joined, as a single link. (implicit argument)
 ż F€ Conjoin and merge the leading spaces with the stars appropriately.
 ŒḄ Create the second half of the hexagon without the middle row.
 Y Join the rows with newlines. This makes the shape look like a hexagon.
Source Link
Erik the Outgolfer
  • 40.8k
  • 5
  • 46
  • 125

Jelly, 24 bytes

R+’μạṀx@6ドルżx@K\€"*$F€ŒḄY

Try it online!

Jelly is ashamed of the fact that it does not have a centralization atom, so it's beaten by 05AB1E and V. By 11 and 7 bytes respectively!

If you find any way to golf this, please comment. Any help is appreciated.

AltStyle によって変換されたページ (->オリジナル) /