Skip to main content
5 of 14
added 348 characters in body
noodle person
  • 10.3k
  • 1
  • 22
  • 76

Uiua, 46 44 42 40 bytes

crossed out 44 is still regular 44 :(

⊏◿13/+×+2⇡4⇌=0[⍉.⊞⟜⊃-+.]-⇡+1×2.:$  O/\-|

Try it! I’m submitting this on the day of the 2024 solar eclipse, which is fitting for a challenge about the sun.

I also like that all of my improvements have been by 2 bytes each :)

As of my latest revision 42 → 40 bytes, this borrows some logic from randomra’s very clever J solution. This still isn’t a direct port as some parts didn’t translate so well to Uiua.

Here’s an explanation of the older version, the new one does the same thing but copies randomra’s idea to actually make the matrices:

Consider the input 3. We double this and add 1 to get the side length 7.

From this we start with the identity matrix, and a reversed copy:

0 0 0 0 0 0 1    1 0 0 0 0 0 0
0 0 0 0 0 1 0    0 1 0 0 0 0 0
0 0 0 0 1 0 0    0 0 1 0 0 0 0
0 0 0 1 0 0 0    0 0 0 1 0 0 0
0 0 1 0 0 0 0    0 0 0 0 1 0 0
0 1 0 0 0 0 0    0 0 0 0 0 1 0
1 0 0 0 0 0 0    0 0 0 0 0 0 1

Also make the array of this many zeros with a 1 at the position of the original input:

0 0 0 1 0 0 0

Create a square matrix of this, and a transposed copy:

0 0 0 0 0 0 0    0 0 0 1 0 0 0
0 0 0 0 0 0 0    0 0 0 1 0 0 0
0 0 0 0 0 0 0    0 0 0 1 0 0 0
1 1 1 1 1 1 1    0 0 0 1 0 0 0
0 0 0 0 0 0 0    0 0 0 1 0 0 0
0 0 0 0 0 0 0    0 0 0 1 0 0 0
0 0 0 0 0 0 0    0 0 0 1 0 0 0

Then we take these 4 matrices in an array and multiply them by 2, 3, 4, and 5 respectively:

0 0 0 2 0 0 0   0 0 0 0 0 0 0
0 0 0 2 0 0 0   0 0 0 0 0 0 0
0 0 0 2 0 0 0   0 0 0 0 0 0 0
0 0 0 2 0 0 0   3 3 3 3 3 3 3
0 0 0 2 0 0 0   0 0 0 0 0 0 0
0 0 0 2 0 0 0   0 0 0 0 0 0 0
0 0 0 2 0 0 0   0 0 0 0 0 0 0

4 0 0 0 0 0 0   0 0 0 0 0 0 5
0 4 0 0 0 0 0   0 0 0 0 0 5 0
0 0 4 0 0 0 0   0 0 0 0 5 0 0
0 0 0 4 0 0 0   0 0 0 5 0 0 0
0 0 0 0 4 0 0   0 0 5 0 0 0 0
0 0 0 0 0 4 0   0 5 0 0 0 0 0
0 0 0 0 0 0 4   5 0 0 0 0 0 0

Sum them all together:

4 0 0  2 0 0 5  
0 4 0  2 0 5 0  
0 0 4  2 5 0 0  
3 3 3 14 3 3 3  
0 0 5  2 4 0 0  
0 5 0  2 0 4 0
5 0 0  2 0 0 4

We’re going to index these numbers into a string to get each character, and that 14 is going to get in the way, so take the results mod 13:

4 0 0 2 0 0 5
0 4 0 2 0 5 0
0 0 4 2 5 0 0
3 3 3 1 3 3 3
0 0 5 2 4 0 0
0 5 0 2 0 4 0
5 0 0 2 0 0 4

Finally index these into a string so that 0 becomes a space, 1 becomes O, 2 becomes |, 3 becomes -, 4 becomes \, and 5 becomes /:

\  |  /
 \ | / 
  \|/  
---O---
  /|\  
 / | \ 
/  |  \
noodle person
  • 10.3k
  • 1
  • 22
  • 76