-4
\$\begingroup\$

Given no input, output the following:

 _
| ~-_
| o  ~-_
| ~     ~-_
|    \~~~~~~
|  *   \
|        \
|~~~~~~~~~~\

Note the backslashes are actually , which is U+FF3C

Trailing whitespace is allowed, however leading whitespace is not.

This is so fewest bytes in each language wins!

\$\endgroup\$
10
  • 7
    \$\begingroup\$ Why don't you use a backslash? Some languages struggle with unicode characters. \$\endgroup\$
    – Okx
    Commented Jun 6, 2017 at 9:36
  • 2
    \$\begingroup\$ @Okx it makes the challenge a little more interesting \$\endgroup\$
    – Mayube
    Commented Jun 6, 2017 at 9:42
  • 6
    \$\begingroup\$ "9/10 Geometers agree" citation please? \$\endgroup\$ Commented Jun 6, 2017 at 9:43
  • 12
    \$\begingroup\$ Despite my happiness to see my country's flag in codegolf, I must say that this is a very bad ascii rendition of Nepali flag.. :D \$\endgroup\$
    – 0xffcourse
    Commented Jun 6, 2017 at 11:18
  • 17
    \$\begingroup\$ Tagged ASCII art, demands non-ASCII characters... \$\endgroup\$
    – Dennis
    Commented Jun 6, 2017 at 13:37

13 Answers 13

4
\$\begingroup\$

05AB1E, 50 bytes

•ζ1VS¹Tšã¦1d’sΩç!ÙT>_äтÿÀ†{ECZ{Ý•7ÝJ"_ -~|\*o"‡8¡»

Try it online!


First I created a translation table as follows:

0   | "_"
1   | " "
2   | "-"
3   | "~"
4   | "|"
5   | "\"
6   | "*"
7   | "o"
8   | "\n"

I then proceeded to replace each unique character in the flag with the number corresponding to the character at that specific position to get the number:

108413208417113208413111113208411115333333841161115841111111158433333333335

Here's the same pattern with the newlines (makes it more obvious):

10
41320
41711320
41311111320
411115333333
41161115
4111111115
433333333335

I then compressed the number into base-255 using 05AB1E (To compress a base-10 number to base 255 simply run 255B in 05AB1E).

Then, see the code explanation for how I rebuild it from the number.


•ζ1VS¹Tšã¦1d’sΩç!ÙT>_äтÿÀ†{ECZ{Ý• # Push the number we discussed.
7ÝJ                               # Push 01234567.
   "_ -~|\*o"                    # Push "_ -~|\*o".
              ‡                   # Replace 0-7 with the appropriate block.
               8¡»                # Split on 8's and print with newlines.
\$\endgroup\$
2
  • \$\begingroup\$ I had glanced at base 255 compression but never really understood it. This is great! \$\endgroup\$
    – Neil A.
    Commented Jun 6, 2017 at 21:41
  • 2
    \$\begingroup\$ This is actually 78 bytes, because this program cannot be encoded in 05AB1E's native encoding and so must be encoded in UTF-8. \$\endgroup\$
    – Okx
    Commented Jul 9, 2017 at 18:40
4
\$\begingroup\$

Python 2, 94 92 96 bytes

print(""" _
| ~-_
| o  ~-_
| ~     ~-_
|    \~~~~~~
|  *   \
|        \
|~~~~~~~~~~\""")

Try it online!

\$\endgroup\$
5
  • \$\begingroup\$ Why the \n at the very end? You don't have to output a trailing new-line. \$\endgroup\$ Commented Jun 6, 2017 at 10:13
  • 2
    \$\begingroup\$ Also, not sure who downvoted you, but I upvoted to neutralize it. Welcome too PPCG! :) \$\endgroup\$ Commented Jun 6, 2017 at 10:17
  • 2
    \$\begingroup\$ @KevinCruijssen Sympathy voting isn't recommended. To the OP, I suggest adding a try it online link to an implementation of your answer (see other answers for link/examples), it helps people validate your code. \$\endgroup\$
    – Notts90
    Commented Jun 7, 2017 at 7:00
  • \$\begingroup\$ I'm counting 97 bytes, 89 chars. \$\endgroup\$ Commented Jun 21, 2017 at 19:26
  • \$\begingroup\$ @Notts90 does help to downvote & say nothing! Can confirm. \$\endgroup\$
    – Stan Strum
    Commented Dec 25, 2017 at 1:44
1
\$\begingroup\$

SOGL, 49 bytes

⁰∑J“ζ"Ω‰Θx(;╝φ╚○Δ§∆qσG⅛>K█׀IR'ΚΧqΞ⅞≥№█▼¡└+Β8‘# ~ŗ

If the flag used any other character than ~, this would be 4 bytes shorter.

\$\endgroup\$
1
\$\begingroup\$

Japt, 83 79 78 bytes (UTF-8)

" _
| ~-_
| o  ~-_
| ~     ~-_
|    \~~~~~~
|  *   \
|{8ç}\
|{Aç'~}\

Hardcodes most of the string

Try it online!

\$\endgroup\$
1
\$\begingroup\$

05AB1E, 76 74 72 66 bytes

-6 bytes thanks to @carusocomputing

'~T×ð8×'~6×ð5×" _
| ~-_
| o  ~-_
| ~ÿ~-_
|    \ÿ
|  *   \
|ÿ\
|ÿ\"

String interpolation replaces the ÿs. In order from first to last, it is: 5 spaces, 6 ~s, 8 spaces, and then 10 ~s

Try it online!

\$\endgroup\$
4
  • \$\begingroup\$ This is perfect for String Interpolation! tio.run/##MzBNTDJM/… \$\endgroup\$ Commented Jun 6, 2017 at 21:06
  • \$\begingroup\$ Basically, what it's doing is the ÿ will pop whatever was previous on the stack and throw it directly into the string, so first we push the 10 tildes followed by the 8 spaces then use two ÿ inside of the string to slam them into it! Saves you 4 bytes and is uncommonly seen ;). A nifty trick few people utilize. \$\endgroup\$ Commented Jun 6, 2017 at 21:07
  • \$\begingroup\$ @carusocomputing: Did not notice that. Thanks! \$\endgroup\$
    – Neil A.
    Commented Jun 6, 2017 at 21:09
  • \$\begingroup\$ Also, for these types of challenges see my answer here: codegolf.stackexchange.com/a/124965/59376 (I only answered to explain base conversion to you =]) \$\endgroup\$ Commented Jun 6, 2017 at 21:31
0
\$\begingroup\$

C#, 89 bytes

_=>@" _
| ~-_
| o  ~-_
| ~     ~-_
|    \~~~~~~
|  *   \
|        \
|~~~~~~~~~~\"

Any formatting options in C# for this require too many extra bytes that it is just cheaper to hard code the output as far as I can tell.

\$\endgroup\$
3
  • \$\begingroup\$ is the @ needed? Are there any characters in there that would need to be escaped otherwise? \$\endgroup\$
    – Mayube
    Commented Jun 6, 2017 at 9:17
  • \$\begingroup\$ The @ is needed to tell the compiler the string will wrap onto newlines. That is shorter than hard coding all the line feeds. No chars need escaping. \$\endgroup\$ Commented Jun 6, 2017 at 9:19
  • 1
    \$\begingroup\$ aaah right, didn't realise @ also allowed a string to be multiline \$\endgroup\$
    – Mayube
    Commented Jun 6, 2017 at 9:19
0
\$\begingroup\$

Java 8, 96 bytes

()->" _\n| ~-_\n| o  ~-_\n| ~     ~-_\n|    \~~~~~~\n|  *   \\n|        \\n|~~~~~~~~~~\"

Boring, but it probably can't be shortened by using some fancy .replace or loops anyway in Java..

Try it here.

\$\endgroup\$
3
  • \$\begingroup\$ According to the meta post, can't you take an unused argument to save a byte? \$\endgroup\$ Commented Jun 6, 2017 at 10:20
  • 1
    \$\begingroup\$ @TheLethalCoder Well, I consider the question to be still in process. And since the only answer stating Yes only has 1 upvote so far, I don't think it's valid (yet). \$\endgroup\$ Commented Jun 6, 2017 at 10:24
  • \$\begingroup\$ Sounds about right then :) \$\endgroup\$ Commented Jun 6, 2017 at 10:26
0
\$\begingroup\$

Mathematica, 84 bytes

"_
| ~-_
| o  ~-_
| ~     ~-_
|    \~~~~~~
|  *   \
|        \
|~~~~~~~~~~\"
\$\endgroup\$
1
  • 4
    \$\begingroup\$ Missing a space between "_? \$\endgroup\$ Commented Jun 6, 2017 at 10:25
0
\$\begingroup\$

Jelly, 51 50 bytes

“ ½|~-o*_‘;65340Ọ“ßṆiṣ€|ʂwĊeḌ\<S@DƝbƘשṗþ8¥Ḅ3Zȥ ’ṃ

Try it online!

\$\endgroup\$
0
\$\begingroup\$

Bubblegum, 40

Not sure why no-one posted the bubblegum answer yet - Is bubblegum frowned upon these days?

xxd dump:

00000000: 5388 e7aa 51a8 d305 91f9 0a50 469d 0210  S...Q......PF...
00000010: 40d9 40f0 7ecf 9e3a 3000 71b5 2002 1019  @.@.~..:0.q. ...
00000020: 0518 a70e 0e80 5c00                      ......\.

Try it online.

\$\endgroup\$
0
\$\begingroup\$

Retina, 60 59 bytes


1_!1~-_!1o2~-_!1~5~-_!4\""!2*3\!8\!"""~\
"
~~~
!
¶|
\d
$* 

Try it online!

\$\endgroup\$
0
\$\begingroup\$

Charcoal, 37 bytes

←×~χ↑⁷ _P¶¶o¶~¶¶ *F³¶~-_↓←×~⁶F⁴«\↘

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

←×~χ

Print the bottom ~s.

↑⁷

Print the left |s.

 _P¶¶o¶~¶¶ *F³¶~-_

Print the upper right line and the interior decoration.

↓←×~⁶

Print the middle ~s.

F⁴«\↘

Print the lower right line.

\$\endgroup\$
0
\$\begingroup\$

Deadfish~, 459 bytes

{iii}iic{iiiiii}iiic{{d}ii}dddddc{{i}}{i}iiiic{{d}i}ddc{{i}d}iiiic{{d}ii}dc{iiiii}c{{d}ii}dddddc{{i}}{i}iiiic{{d}i}ddc{{i}dd}dc{{d}ii}icc{{i}d}iiiic{{d}ii}dc{iiiii}c{{d}ii}dddddc{{i}}{i}iiiic{{d}i}ddc{{i}d}iiiic{{d}i}ddddccccc{{i}d}iiiic{{d}ii}dc{iiiii}c{{d}ii}dddddc{{i}}{i}iiiic{{d}i}ddcccc{iiiiii}c{iii}iiiicccccc{{d}}{d}ddddddc{{i}}{i}iiiic{{d}i}ddcc{i}c{d}ccc{iiiiii}c{{d}ii}ddc{{i}}{i}iiiic{{d}i}ddcccccccc{iiiiii}c{{d}ii}ddc{{i}}{i}iiiicii{c}{ddd}ddddc

Try it online!

Uses backslashes instead.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.