Skip to main content
deleted 210 characters in body
Source Link
Neil
  • 177.2k
  • 12
  • 74
  • 281

Charcoal, 3838 37 bytes

XF³²«F…·±ιιF…·±ιι«Jκλ›⁼№KMX¹⁼KKX»UMKAXJ³¹¦³¹XF³²«UMKAXF⁶³F⁶³«Jκλ›⁼№KMX¹⁼KKX

Try it online!Try it online! Link is to verbose version of code. According to my comment on the Sandbox post I can do this in 37 bytes but unfortunately my computer rebooted to install updates and I didn't save my solution. Explanation:

XJ³¹¦³¹X

Output the central X in the centre of the square.

F³²«

Grow the snowflake 31 times. (The firstlast loop has no effect since it only checks one squareis just used for its side-effect of replacing the -s with Xs.)

F…·±ιιF…·±ιι«UMKAX

Check a larger square each time.Change all the (This is golfier than hardcoding-s to Xs.

F⁶³F⁶³«

Iterate over the sizesquare.)

Jκλ

Jump to each position in the square.

›⁼№KMX¹⁼KKX

If the cell does not yet have an X but it has one neighbouring X then print a -.

»UMKAX

After checking the square, change all the -s to Xs.

Charcoal, 38 bytes

XF³²«F…·±ιιF…·±ιι«Jκλ›⁼№KMX¹⁼KKX»UMKAX

Try it online! Link is to verbose version of code. According to my comment on the Sandbox post I can do this in 37 bytes but unfortunately my computer rebooted to install updates and I didn't save my solution. Explanation:

X

Output the central X.

F³²«

Grow the snowflake 31 times. (The first loop has no effect since it only checks one square.)

F…·±ιιF…·±ιι«

Check a larger square each time. (This is golfier than hardcoding the size.)

Jκλ

Jump to each position in the square.

›⁼№KMX¹⁼KKX

If the cell does not yet have an X but it has one neighbouring X then print a -.

»UMKAX

After checking the square, change all the -s to Xs.

Charcoal, 38 37 bytes

J³¹¦³¹XF³²«UMKAXF⁶³F⁶³«Jκλ›⁼№KMX¹⁼KKX

Try it online! Link is to verbose version of code. Explanation:

J³¹¦³¹X

Output the X in the centre of the square.

F³²«

Grow the snowflake 31 times. (The last loop is just used for its side-effect of replacing the -s with Xs.)

UMKAX

Change all the -s to Xs.

F⁶³F⁶³«

Iterate over the square.

Jκλ

Jump to each position in the square.

›⁼№KMX¹⁼KKX

If the cell does not yet have an X but it has one neighbouring X then print a -.

Source Link
Neil
  • 177.2k
  • 12
  • 74
  • 281

Charcoal, 38 bytes

XF³²«F…·±ιιF…·±ιι«Jκλ›⁼№KMX¹⁼KKX»UMKAX

Try it online! Link is to verbose version of code. According to my comment on the Sandbox post I can do this in 37 bytes but unfortunately my computer rebooted to install updates and I didn't save my solution. Explanation:

X

Output the central X.

F³²«

Grow the snowflake 31 times. (The first loop has no effect since it only checks one square.)

F…·±ιιF…·±ιι«

Check a larger square each time. (This is golfier than hardcoding the size.)

Jκλ

Jump to each position in the square.

›⁼№KMX¹⁼KKX

If the cell does not yet have an X but it has one neighbouring X then print a -.

»UMKAX

After checking the square, change all the -s to Xs.