Skip to main content
2 of 2
added 1357 characters in body
Kevin Cruijssen
  • 131.5k
  • 13
  • 144
  • 384

05AB1E, 25 23 bytes

>"|-/\"SI4*×J…+8×Λ1'O0Λ

Try it online.

Explanation:

Step 1: Draw the ASCII sun without its center:

>                  # Increase the (implicit) input-integer by 1
 "|-/\"S          "# Push list ["|","-","/","\"]
        I4*        # Push the input-integer, and multiply it by 4
           ×       # Repeat each character that many times
            J      # Join it together to a single string
             …+8×  # Push string "+8×"
                 Λ # Use the Canvas builtin with these three arguments

Try just step 1 online.
See this 05AB1E tip of mine to understand how the Canvas builtin and its arguments works.

Step 2: Fix the center:

1'O0              '# # Push 1,"O",0
    Λ              # Use the Canvas of step 1 as background, and overwrite it
                   # with the result of this Canvas
                   # (after which the result is output immediately as result)

Old 25 bytes approach using mirrors:

>I…-\|×{1ú68780.Λ¨'O«.º.∊

Try it online.

Explanation:

Step 1: Draw the top-right corner:

>                  # Increase the (implicit) input-integer by 1
 …-\|              # Push string "-\|"
     I×            # Repeat it the input amount of times
       {           # Sort it, so it's in the order "--\\||" again
        1ú         # Pad a leading space
          68780    # Push 68780
               .Λ  # Use the modifiable Canvas builtin with these three arguments

Try just step 1 online.
See this 05AB1E tip of mine to understand how the Canvas builtin and its arguments works.

Step 2: Fix the center O:

¨                 # Remove the trailing character
 'O«             '# Append an "O" instead

Try just the first two steps online.

Step 3: Mirror it in both directions, and output the result:

.º                # Intersected mirror it horizontally
  .∊              # Intersected mirror it vertically
                  # (after which the result is output implicitly)
Kevin Cruijssen
  • 131.5k
  • 13
  • 144
  • 384