Skip to main content
added 439 characters in body
Source Link
Jacob
  • 12.9k
  • 1
  • 33
  • 92

It should be noted that Uiua actually has a built-in constant containing the colors of the pride flag. That said, this solution avoids using this constant by compressing the colors.

Uiua, 34 33 30 29 2725 bytes

▽34≡↯300↯6_3÷2⊥₃282319238

or 25 bytes with an experimental feature; read on Try it here. Here's the output: (resized to take up less space on the page)

Screenshot of pride flag generated by the program

This uses the recently-stabilized function ⊥ base in order to get the colors of the flag.

Uiua's format for images uses has colors as length-3 arrays of numbers between 0 and 1, representing the red, green, and blue components of each pixel. This solution uses a color palette that allows each of these colors to be represented by combinations of 0, 0.5, and 1. The array of colors doubled is all numbers in 0, 1, and 2, which can then be treated as an integer in base-3.

Below is a solution which works in older versions of the language, before the addition of ⊥ base:

Uiua, 34 33 30 29 27 bytes

▽34≡↯300↯6_3⍜⊏÷₂4_15⋯181465

Try it!

I noticed that the existing Uiua solution used a lot of bytes storing the RGB values of the 6 colors, so I decided to compress those, which is the main reason this is shorter. I chose a color palette just uses 0, 0.5, and 1 as the RGB components of the colors:

       red        orange       yellow     green      blue       purple
color  [1 0 0]    [1 0.5 0]    [1 1 0]    [0 1 0]    [0 0 1]    [0.5 0 1]
hex    #ff0000    #ff8000      #ffff00    #00ff00    #0000ff    #8000ff

Since there are only two occurrences of 0.5, I decided to store this list by replacing those 0.5s with 1s, read this as binary, and keep track of what the indices of the 0.5s were. This gives the integer 181,465 for the binary, and the (0-based) indices 4 and 15 to be halved:

⋯181465  100110110010001101
4_15         ^          ^

It would be more efficient to double each number and treat it as an integer in base 3, but Uiua's function for conversion to arbitrary bases is base which is too long of a name for the method to be shorter.

To generate the actual image, the program takes 300 of each color, then 34 of each row.

Here's the output: (resized to take up less space on the page)

Screenshot of pride flag generated by the program

With # Experimental! features enabled, the function ⊥ base which recently got a glyph allows the usage of base 3 to get the colors, as mentioned above.

▽34≡↯300↯6_3÷2⊥₃282319238

Uiua, 34 33 30 29 27 bytes

or 25 bytes with an experimental feature; read on

▽34≡↯300↯6_3⍜⊏÷₂4_15⋯181465

Try it!

I noticed that the existing Uiua solution used a lot of bytes storing the RGB values of the 6 colors, so I decided to compress those, which is the main reason this is shorter. I chose a color palette just uses 0, 0.5, and 1 as the RGB components of the colors:

       red        orange       yellow     green      blue       purple
color  [1 0 0]    [1 0.5 0]    [1 1 0]    [0 1 0]    [0 0 1]    [0.5 0 1]
hex    #ff0000    #ff8000      #ffff00    #00ff00    #0000ff    #8000ff

Since there are only two occurrences of 0.5, I decided to store this list by replacing those 0.5s with 1s, read this as binary, and keep track of what the indices of the 0.5s were. This gives the integer 181,465 for the binary, and the (0-based) indices 4 and 15 to be halved:

⋯181465  100110110010001101
4_15         ^          ^

It would be more efficient to double each number and treat it as an integer in base 3, but Uiua's function for conversion to arbitrary bases is base which is too long of a name for the method to be shorter.

To generate the actual image, the program takes 300 of each color, then 34 of each row.

Here's the output: (resized to take up less space on the page)

Screenshot of pride flag generated by the program

With # Experimental! features enabled, the function ⊥ base which recently got a glyph allows the usage of base 3 to get the colors, as mentioned above.

▽34≡↯300↯6_3÷2⊥₃282319238

It should be noted that Uiua actually has a built-in constant containing the colors of the pride flag. That said, this solution avoids using this constant by compressing the colors.

Uiua, 25 bytes

▽34≡↯300↯6_3÷2⊥₃282319238

Try it here. Here's the output: (resized to take up less space on the page)

Screenshot of pride flag generated by the program

This uses the recently-stabilized function ⊥ base in order to get the colors of the flag.

Uiua's format for images uses has colors as length-3 arrays of numbers between 0 and 1, representing the red, green, and blue components of each pixel. This solution uses a color palette that allows each of these colors to be represented by combinations of 0, 0.5, and 1. The array of colors doubled is all numbers in 0, 1, and 2, which can then be treated as an integer in base-3.

Below is a solution which works in older versions of the language, before the addition of ⊥ base:

Uiua, 34 33 30 29 27 bytes

▽34≡↯300↯6_3⍜⊏÷₂4_15⋯181465

Try it!

I noticed that the existing Uiua solution used a lot of bytes storing the RGB values of the 6 colors, so I decided to compress those, which is the main reason this is shorter. I chose a color palette just uses 0, 0.5, and 1 as the RGB components of the colors:

       red        orange       yellow     green      blue       purple
color  [1 0 0]    [1 0.5 0]    [1 1 0]    [0 1 0]    [0 0 1]    [0.5 0 1]
hex    #ff0000    #ff8000      #ffff00    #00ff00    #0000ff    #8000ff

Since there are only two occurrences of 0.5, I decided to store this list by replacing those 0.5s with 1s, read this as binary, and keep track of what the indices of the 0.5s were. This gives the integer 181,465 for the binary, and the (0-based) indices 4 and 15 to be halved:

⋯181465  100110110010001101
4_15         ^          ^

To generate the actual image, the program takes 300 of each color, then 34 of each row.

deleted 143 characters in body
Source Link
Jacob
  • 12.9k
  • 1
  • 33
  • 92

Uiua, 34 33 30 29 27 bytes

or 2625 bytes with uglier colors;an experimental feature; read on

▽34≡↯300↯6_3⍜⊏÷₂4_15⋯181465

Try it!

I noticed that the existing Uiua solution used a lot of bytes storing the RGB values of the 6 colors, so I decided to compress those, which is the main reason this is shorter. I chose a color palette just uses 0, 0.5, and 1 as the RGB components of the colors:

       red        orange       yellow     green      blue       purple
color  [1 0 0]    [1 0.5 0]    [1 1 0]    [0 1 0]    [0 0 1]    [0.5 0 1]
hex    #ff0000    #ff8000      #ffff00    #00ff00    #0000ff    #8000ff

Since there are only two occurrences of 0.5, I decided to store this list by replacing those 0.5s with 1s, read this as binary, and keep track of what the indices of the 0.5s were. This gives the integer 181,465 for the binary, and the (0-based) indices 4 and 15 to be halved:

⋯181465  100110110010001101
4_15         ^          ^

It would be more efficient to double each number and treat it as an integer in base 3, but Uiua's function for conversion to arbitrary bases is base which is too long of a name for the method to be shorter.

To generate the actual image, the program takes 300 of each color, then 34 of each row.

Here's the output: (resized to take up less space on the page)

Screenshot of pride flag generated by the program

If you're okay with uglier colorsWith # Experimental! features enabled, we can take the function sinebase ofwhich recently got a glyph allows the 1s atusage of base 3 to get the specified indices, rather than halving themcolors, for 26 bytes: Try itas mentioned above.

▽34≡↯300↯6_3⍜⊏∿4_15⋯181465▽34≡↯300↯6_3÷2⊥₃282319238

screenshot of flag with uglier colors

Uiua, 34 33 30 29 27 bytes

or 26 bytes with uglier colors; read on

▽34≡↯300↯6_3⍜⊏÷₂4_15⋯181465

Try it!

I noticed that the existing Uiua solution used a lot of bytes storing the RGB values of the 6 colors, so I decided to compress those, which is the main reason this is shorter. I chose a color palette just uses 0, 0.5, and 1 as the RGB components of the colors:

       red        orange       yellow     green      blue       purple
color  [1 0 0]    [1 0.5 0]    [1 1 0]    [0 1 0]    [0 0 1]    [0.5 0 1]
hex    #ff0000    #ff8000      #ffff00    #00ff00    #0000ff    #8000ff

Since there are only two occurrences of 0.5, I decided to store this list by replacing those 0.5s with 1s, read this as binary, and keep track of what the indices of the 0.5s were. This gives the integer 181,465 for the binary, and the (0-based) indices 4 and 15 to be halved:

⋯181465  100110110010001101
4_15         ^          ^

It would be more efficient to double each number and treat it as an integer in base 3, but Uiua's function for conversion to arbitrary bases is base which is too long of a name for the method to be shorter.

To generate the actual image, the program takes 300 of each color, then 34 of each row.

Here's the output: (resized to take up less space on the page)

Screenshot of pride flag generated by the program

If you're okay with uglier colors, we can take the sine of the 1s at the specified indices, rather than halving them, for 26 bytes: Try it

▽34≡↯300↯6_3⍜⊏∿4_15⋯181465

screenshot of flag with uglier colors

Uiua, 34 33 30 29 27 bytes

or 25 bytes with an experimental feature; read on

▽34≡↯300↯6_3⍜⊏÷₂4_15⋯181465

Try it!

I noticed that the existing Uiua solution used a lot of bytes storing the RGB values of the 6 colors, so I decided to compress those, which is the main reason this is shorter. I chose a color palette just uses 0, 0.5, and 1 as the RGB components of the colors:

       red        orange       yellow     green      blue       purple
color  [1 0 0]    [1 0.5 0]    [1 1 0]    [0 1 0]    [0 0 1]    [0.5 0 1]
hex    #ff0000    #ff8000      #ffff00    #00ff00    #0000ff    #8000ff

Since there are only two occurrences of 0.5, I decided to store this list by replacing those 0.5s with 1s, read this as binary, and keep track of what the indices of the 0.5s were. This gives the integer 181,465 for the binary, and the (0-based) indices 4 and 15 to be halved:

⋯181465  100110110010001101
4_15         ^          ^

It would be more efficient to double each number and treat it as an integer in base 3, but Uiua's function for conversion to arbitrary bases is base which is too long of a name for the method to be shorter.

To generate the actual image, the program takes 300 of each color, then 34 of each row.

Here's the output: (resized to take up less space on the page)

Screenshot of pride flag generated by the program

With # Experimental! features enabled, the function base which recently got a glyph allows the usage of base 3 to get the colors, as mentioned above.

▽34≡↯300↯6_3÷2⊥₃282319238
deleted 161 characters in body
Source Link
Jacob
  • 12.9k
  • 1
  • 33
  • 92

Uiua, 34 33 30 29 29 27 bytes

or 26 bytes with uglier colors; read on

▽34≡↯300↯6_3⍜⊏(÷2)4_15⋯181465▽34≡↯300↯6_3⍜⊏÷₂4_15⋯181465

Try it!Try it!

I noticed that the existing Uiua solution used a lot of bytes storing the RGB values of the 6 colors, so I decided to compress those, which is the main reason this is shorter. I chose a color palette just uses 0, 0.5, and 1 as the RGB components of the colors:

       red        orange       yellow     green      blue       purple
color  [1 0 0]    [1 0.5 0]    [1 1 0]    [0 1 0]    [0 0 1]    [0.5 0 1]
hex    #ff0000    #ff8000      #ffff00    #00ff00    #0000ff    #8000ff

Since there are only two occurrences of 0.5, I decided to store this list by replacing those 0.5s with 1s, read this as binary, and keep track of what the indices of the 0.5s were. This gives the integer 181,465 for the binary, and the (0-based) indices 4 and 15 to be halved:

⋯181465  100110110010001101
4_15         ^          ^

It would be more efficient to double each number and treat it as an integer in base 3, but Uiua's function for conversion to arbitrary bases is base which is too long to be shorter. And currently, that function needs to be enabled withof a # Experimental! comment anyway; at that point, I could use experimental subscriptsname for the method to write (÷2) as ÷₂, which is evenbe shorter.

To generate the actual image, the program takes 300 of each color, then 34 of each row.

Here's the output: (resized to take up less space on the page)

Screenshot of pride flag generated by the program

If you're okay with uglier colors, we can take the ∿ sine of the 1s at the specified indices, rather than halving them, for 26 bytes: Try it

▽34≡↯300↯6_3⍜⊏∿4_15⋯181465

screenshot of flag with uglier colors

Uiua, 34 33 30 29 bytes

or 26 bytes with uglier colors; read on

▽34≡↯300↯6_3⍜⊏(÷2)4_15⋯181465

Try it!

I noticed that the existing Uiua solution used a lot of bytes storing the RGB values of the 6 colors, so I decided to compress those, which is the main reason this is shorter. I chose a color palette just uses 0, 0.5, and 1 as the RGB components of the colors:

       red        orange       yellow     green      blue       purple
color  [1 0 0]    [1 0.5 0]    [1 1 0]    [0 1 0]    [0 0 1]    [0.5 0 1]
hex    #ff0000    #ff8000      #ffff00    #00ff00    #0000ff    #8000ff

Since there are only two occurrences of 0.5, I decided to store this list by replacing those 0.5s with 1s, read this as binary, and keep track of what the indices of the 0.5s were. This gives the integer 181,465 for the binary, and the (0-based) indices 4 and 15 to be halved:

⋯181465  100110110010001101
4_15         ^          ^

It would be more efficient to double each number and treat it as an integer in base 3, but Uiua's function for conversion to arbitrary bases is base which is too long to be shorter. And currently, that function needs to be enabled with a # Experimental! comment anyway; at that point, I could use experimental subscripts to write (÷2) as ÷₂, which is even shorter.

To generate the actual image, the program takes 300 of each color, then 34 of each row.

Here's the output: (resized to take up less space on the page)

Screenshot of pride flag generated by the program

If you're okay with uglier colors, we can take the ∿ sine of the 1s at the specified indices, rather than halving them, for 26 bytes: Try it

▽34≡↯300↯6_3⍜⊏∿4_15⋯181465

screenshot of flag with uglier colors

Uiua, 34 33 30 29 27 bytes

or 26 bytes with uglier colors; read on

▽34≡↯300↯6_3⍜⊏÷₂4_15⋯181465

Try it!

I noticed that the existing Uiua solution used a lot of bytes storing the RGB values of the 6 colors, so I decided to compress those, which is the main reason this is shorter. I chose a color palette just uses 0, 0.5, and 1 as the RGB components of the colors:

       red        orange       yellow     green      blue       purple
color  [1 0 0]    [1 0.5 0]    [1 1 0]    [0 1 0]    [0 0 1]    [0.5 0 1]
hex    #ff0000    #ff8000      #ffff00    #00ff00    #0000ff    #8000ff

Since there are only two occurrences of 0.5, I decided to store this list by replacing those 0.5s with 1s, read this as binary, and keep track of what the indices of the 0.5s were. This gives the integer 181,465 for the binary, and the (0-based) indices 4 and 15 to be halved:

⋯181465  100110110010001101
4_15         ^          ^

It would be more efficient to double each number and treat it as an integer in base 3, but Uiua's function for conversion to arbitrary bases is base which is too long of a name for the method to be shorter.

To generate the actual image, the program takes 300 of each color, then 34 of each row.

Here's the output: (resized to take up less space on the page)

Screenshot of pride flag generated by the program

If you're okay with uglier colors, we can take the ∿ sine of the 1s at the specified indices, rather than halving them, for 26 bytes: Try it

▽34≡↯300↯6_3⍜⊏∿4_15⋯181465

screenshot of flag with uglier colors

added 87 characters in body
Source Link
Jacob
  • 12.9k
  • 1
  • 33
  • 92
Loading
added 357 characters in body
Source Link
Jacob
  • 12.9k
  • 1
  • 33
  • 92
Loading
added 383 characters in body
Source Link
Jacob
  • 12.9k
  • 1
  • 33
  • 92
Loading
deleted 172 characters in body
Source Link
Jacob
  • 12.9k
  • 1
  • 33
  • 92
Loading
deleted 293 characters in body
Source Link
Jacob
  • 12.9k
  • 1
  • 33
  • 92
Loading
added 156 characters in body
Source Link
Jacob
  • 12.9k
  • 1
  • 33
  • 92
Loading
added 13 characters in body
Source Link
Jacob
  • 12.9k
  • 1
  • 33
  • 92
Loading
added 1 character in body
Source Link
Jacob
  • 12.9k
  • 1
  • 33
  • 92
Loading
Source Link
Jacob
  • 12.9k
  • 1
  • 33
  • 92
Loading