28
\$\begingroup\$

This is a problem on Luogu OJ. I decided to post it here because on Luogu OJ, many people, including me and my friend, are interested about how to solve this problem within the fewest characters.

Your task is to output the following ASCII-art:

               ************
               ####....#.
             #..###.....##....
             ###.......######              ###            ###
                ...........               #...#          #...#
               ##*#######                 #.#.#          #.#.#
            ####*******######             #.#.#          #.#.#
           ...#***.****.*###....          #...#          #...#
           ....**********##.....           ###            ###
           ....****    *****....
             ####        ####
           ######        ######
##############################################################
#...#......#.##...#......#.##...#......#.##------------------#
###########################################------------------#
#..#....#....##..#....#....##..#....#....#####################
##########################################    #----------#
#.....#......##.....#......##.....#......#    #----------#
##########################################    #----------#
#.#..#....#..##.#..#....#..##.#..#....#..#    #----------#
##########################################    ############

This is code-golf, so shortest program wins.

\$\endgroup\$
  • 7
    \$\begingroup\$ Is additional whitespace (for example to make a rectangle of characters) on the right hand side allowed? what about a trailing newline? \$\endgroup\$ – Level River St Sep 12 at 19:29
  • \$\begingroup\$ @LevelRiverSt Sorry for late reply. Yes, the OJ automatically strips all trailing whitespace/tab/newline and all whitespace/tab on the right hand side. \$\endgroup\$ – HighlyRadioactive Sep 14 at 5:56

24 Answers 24

22
\$\begingroup\$

Brainfuck, 1347 bytes

Why do i do this to myself

+++++[>+++++++++>+++++++>++++++>++++++++>+++++++++>++<<<<<<-]>+>>++>++<<>...............>............>>.<<<...............<....<....>.<.>>>>>.<<<.............<.<..>...<.....>..<....>>>>>.<<<.............<...<.......>......>..<<<++[->>>............<...<<]>>>>>>.<<<................<<...........>>.....<<<++[->>>..........<.<...>.<<]>>>>>>.<<<...............<..>>.<<.......>.......<<<++[->>>..........<.<.>.<.>.<<]>>>>>>.<<<............<....>>.......<<......>...<<<++[->>>..........<.<.>.<.>.<<]>>>>>>.<<<...........<<...>><.>>...<<<.>>>....<<<.>>>.<<...<....>>..........<.<.>.<.>.>..........<.<.>.<.>.>>>>.<<<...........<<....>>>..........<<..<.....>>...........<...>............<...>>>>.<<<...........<<....>>>....<....>.....<<<....>>>>>.<<<.....<<<++[->>>........<....<<]>>>>>>.<<<...<<<++[->>>........<......<<]>>>>>>.<<<<<<+++++++[->>........<<]>>......>>>>.<<<<<<+++[->>.<...>.<......>.<.>.<<]>>.>>>..................<<<.>>>>.<<<<<<+++++++[->>......<<]>>.>>>..................<<<.>>>>.<<<<<<+++[->>.<..>.<....>.<....>.<<]<+++++[->>>....<<<]>>>>>>>.<<<<<<+++++++[->>......<<]>>>....<.>>>..........<<<.>>>>.<<<<<<+++[->>.<.....>.<......>.<<]>>>....<.>>>..........<<<.>>>>.<<<<<<+++++++[->>......<<]>>>....<.>>>..........<<<.>>>>.<<<<<<+++[->>.<.>.<..>.<....>.<..>.<<]>>>....<.>>>..........<<<.>>>>.<<<<<<+++++++[->>......<<]>>>....<............

Try it online!

The "readable" version :

+++++[>+++++++++>+++++++>++++++>++++++++>+++++++++>++<<<<<<-]>+>>++>++

<<
>...............>............>>.
<<<...............<....<....>.<.>>>>>.
<<<.............<.<..>...<.....>..<....>>>>>.
<<<.............<...<.......>......>..<<<++[->>>............<...<<]>>>>>>.
<<<................<<...........>>.....<<<++[->>>..........<.<...>.<<]>>>>>>.
<<<...............<..>>.<<.......>.......<<<++[->>>..........<.<.>.<.>.<<]>>>>>>.
<<<............<....>>.......<<......>...<<<++[->>>..........<.<.>.<.>.<<]>>>>>>.
<<<...........<<...>><.>>...<<<.>>>....<<<.>>>.<<...<....>>..........<.<.>.<.>.>..........<.<.>.<.>.>>>>.
<<<...........<<....>>>..........<<..<.....>>...........<...>............<...>>>>.
<<<...........<<....>>>....<....>.....<<<....>>>>>.
<<<.....<<<++[->>>........<....<<]>>>>>>.
<<<...<<<++[->>>........<......<<]>>>>>>.
<<<<<<+++++++[->>........<<]>>......>>>>.
<<<<<<+++[->>.<...>.<......>.<.>.<<]>>.>>>..................<<<.>>>>.
<<<<<<+++++++[->>......<<]>>.>>>..................<<<.>>>>.
<<<<<<+++[->>.<..>.<....>.<....>.<<]<+++++[->>>....<<<]>>>>>>>.
<<<<<<+++++++[->>......<<]>>>....<.>>>..........<<<.>>>>.
<<<<<<+++[->>.<.....>.<......>.<<]>>>....<.>>>..........<<<.>>>>.
<<<<<<+++++++[->>......<<]>>>....<.>>>..........<<<.>>>>.
<<<<<<+++[->>.<.>.<..>.<....>.<..>.<<]>>>....<.>>>..........<<<.>>>>.
<<<<<<+++++++[->>......<<]>>>....<............
\$\endgroup\$
  • 1
    \$\begingroup\$ That is nothing short of amazing. Did you design it yourself or use a programm to aid you? \$\endgroup\$ – jaaq Sep 13 at 13:27
  • 4
    \$\begingroup\$ Did it myself. Also i know there is probably a better and shorter way to do this, but tbh it was painful enouth to draw mario in brainfuck by hand. \$\endgroup\$ – The random guy Sep 13 at 13:28
  • 5
    \$\begingroup\$ On the plus-side, you know abso-f-ing-lutely nobody is going to try and come up with a competing shorter version :D \$\endgroup\$ – CD001 Sep 13 at 15:24
  • 4
    \$\begingroup\$ @CD001 is that a challenge? \$\endgroup\$ – Benjamin Urquhart Sep 14 at 22:55
  • 1
    \$\begingroup\$ @Evorlor well there are brainfuck compilers, macros and scripts that can translate readable instructions into brainfuck. By "by hand" I meant whether he constructed the code entirely by himself which he acually did. Kudos for that. \$\endgroup\$ – jaaq Sep 17 at 6:59
16
\$\begingroup\$

T-SQL, 322 298 288 bytes

SELECT CONCAT('',DECOMPRESS(CAST('H4sIAAAAAAACA6WRQYrEIBQF955CqJ0wdf/jjehM2rwOdofUQvIoHj9f65m2UMLRsYNng/4ZQU0NThjUtBFLDXwRBpWIWYfGpCaIRCy5cZswuFVX6U3bOAA73/+8nXYw2368uWwfj3r5MKzfq4W0UHhEQcUBsk0/b9yafllX9P/YpeDu7rVDTF6226WoPpy6bMUmPZ66UH4BHz4rVE8EAAA='as XML).value('.','varbinary(max)')))

Uses G-Zip compression built into SQL 2016 and later, along with Base64 encoding, see this tips post for details.

In SSMS, you'll either have to output as text after fiddling with SSMS character limits in settings, or just copy-and-paste the output to the code window:

enter image description here

EDITS: Saved 24 bytes with a better compressed string, thanks to @someone; saved 10 bytes with an implicit conversion using CONCAT, thanks to @digscoop.

\$\endgroup\$
  • 2
    \$\begingroup\$ I think I have a shorter base64 gzip string, H4sIAAAAAAACA6WRQYrEIBQF955CqJ0wdf/jjehM2rwOdofUQvIoHj9f65m2UMLRsYNng/4ZQU0NThjUtBFLDXwRBpWIWYfGpCaIRCy5cZswuFVX6U3bOAA73/+8nXYw2368uWwfj3r5MKzfq4W0UHhEQcUBsk0/b9yafllX9P/YpeDu7rVDTF6226WoPpy6bMUmPZ66UH4BHz4rVE8EAAA=. I can't test this because I have no idea how, but you might or might not be able to omit the =. \$\endgroup\$ – my pronoun is monicareinstate Sep 12 at 15:18
  • \$\begingroup\$ @someone Thanks, that string does work (it does need the =), and saves 24 bytes; guess my encoding routine is far from ideal. \$\endgroup\$ – BradC Sep 12 at 15:41
  • 1
    \$\begingroup\$ You could use a nameless variable and implicit conversion to shorten it a bit more. Try: DECLARE @ XML='H4sIAAAAAAACA6WRQYrEIBQF955CqJ0wdf/jjehM2rwOdofUQvIoHj9f65m2UMLRsYNng/4ZQU0NThjUtBFLDXwRBpWIWYfGpCaIRCy5cZswuFVX6U3bOAA73/+8nXYw2368uWwfj3r5MKzfq4W0UHhEQcUBsk0/b9yafllX9P/YpeDu7rVDTF6226WoPpy6bMUmPZ66UH4BHz4rVE8EAAA='SELECT CONCAT('',DECOMPRESS(@.value('.','varbinary(max)'))) \$\endgroup\$ – digscoop Sep 13 at 13:29
  • \$\begingroup\$ Thanks, @digscoop, saved me 10 bytes. I used the CONCAT trick, but not the XML variable, since that would have added back 3 bytes (it would be shorter, though, in situations I already had a variable) \$\endgroup\$ – BradC Sep 13 at 14:02
12
\$\begingroup\$

PHP, 176 155 bytes

-21 bytes thanks to Ryan Moore's super compressed string.

This version uses raw output of gzdeflate and contains unprintable binary data, so the code itself and TIO link cannot be posted here, but here is a hex dump of it:

000000  3c 3f 3d 67 7a 69 6e 66 6c 61 74 65 28 27 a5 91
000010  81 06 04 21 00 44 01 e8 2b e2 01 71 ef ff 3f ef
000020  5c 91 76 f6 64 57 0f 31 c6 98 a6 ea 95 b6 50 c2
000030  03 50 c5 ab 83 0e 47 41 4d 1b 1c d0 a9 e9 86 2c
000040  35 70 62 38 a8 84 cc 38 34 06 35 41 24 64 c9 c5
000050  6d 40 e7 55 5c fd a5 6d fd 00 54 9f 5f 5e b5 4d
000060  40 d5 a7 2f 37 d3 f3 53 ef 1f b3 0e 22 e2 90 2e
000070  14 8e 28 a8 d8 41 b6 ea 73 e3 55 fb df b8 a2 3a
000080  8e ad 4a de 6d ef 0f 16 cd cb ba 9d ca e8 59 eb
000090  b2 8a 9d 3a 6d 5d f8 02 27 29 3b

Thanks to @dzaima, here is a TIO which uses bash to create and run this file: Try it online!

This basically reverses the deflate and prints the result. Save it as a binary file then execute it like this: php mario.php


PHP, 239 216 bytes

-23 bytes thanks to Ryan Moore's super compressed string.

<?=gzinflate(base64_decode('pZGBBgQhAEQB6CviAXHv/z/vXJF29mRXDzHGmKbqlbZQwgNQxauDDkdBTRsc0Knphiw1cGI4qITMODQGNUEkZMnFbUDnVVz9pW39AFSfX161TUDVpy830/NT7x+zDiLikC4Ujiio2EG26nPjVfvfuKI6jq1K3m3vDxbNy7qdyuhZ67KKnTptXfgC'));

Try it online!

Same as above version, but used base64_encode on output of gzdeflate, so the code is readable and TIO link is available too. This basically reverses the base64 and deflate and prints the result.

\$\endgroup\$
  • 1
    \$\begingroup\$ TIO link using bash to properly create the file \$\endgroup\$ – dzaima Sep 12 at 19:33
  • \$\begingroup\$ @dzaima Thanks a lot! Didn't know we could run other commands with bash in TIO. \$\endgroup\$ – Night2 Sep 13 at 9:11
  • 1
    \$\begingroup\$ Save 2 bytes for the pro version or 22 bytes for the semipro with pZGBBgQhAEQB6CviAXHv/z/vXJF29mRXDzHGmKbqlbZQwgNQxauDDkdBTRsc0Knphiw1cGI4qITMODQGNUEkZMnFbUDnVVz9pW39AFSfX161TUDVpy830/NT7x+zDiLikC4Ujiio2EG26nPjVfvfuKI6jq1K3m3vDxbNy7qdyuhZ67KKnTptXfgC \$\endgroup\$ – Ryan Moore Sep 13 at 22:35
  • 1
    \$\begingroup\$ @Ryan Moore Thanks a lot! It actually saved 21 bytes on binary version and 23 bytes on readable version. How did you achieve such higher compression? Do you have any special tool and or settings? \$\endgroup\$ – Night2 Sep 14 at 5:07
  • 1
    \$\begingroup\$ @Night2 I use advdef from advancemame.it - it uses Zopfli to try a zillion different options and usually does better compression than regular gzip. The problem is that it only works on .gz content, so you have to gzip the original, advdef the .gz, and then strip off the .gz headers for PHP gzinflate to use it. \$\endgroup\$ – Ryan Moore Sep 15 at 15:20
10
\$\begingroup\$

Bubblegum, 138 bytes

00000000: a591 410a 0321 0003 efbe 6261 6e42 e7ff  ..A..!....banB..
00000010: cf2b b522 6e5a 6cc5 3908 2184 18bd eed4  .+."nZl.9.!.....
00000020: 8912 1e80 2ade 1db4 3b82 9a76 f794 c695  ....*...;..v....
00000030: 6ec8 7205 0e0c 0795 9019 874a 1677 1009  n.r........J.w..
00000040: 5972 717d 4363 2bae bed2 d676 00aa ff5f  Yrq}Cc+....v..._
00000050: 5eb5 0e40 d5df 2f17 e9f1 a99a 1f33 0f22  ^..@../......3."
00000060: e290 2e14 8e28 a8d8 4096 eaf1 c156 fbd7  .....(..@....V..
00000070: b8a2 f663 a992 bded edc1 a279 5ab7 5219  ...c.......yZ.R.
00000080: 3d6b 9d56 b152 a7ad 134f                 =k.V.R...O

Try it online!

\$\endgroup\$
  • 1
    \$\begingroup\$ For comparison, I tried outputting the entire image as a single Charcoal compressed string, which results in a 155-byte program. Trying to draw parts using Charcoal commands actually increases the length. \$\endgroup\$ – Neil Sep 15 at 19:11
  • \$\begingroup\$ Interesting "language", it truly does kick a$$ 😛 \$\endgroup\$ – roblogic Sep 17 at 3:08
8
\$\begingroup\$

Jelly, 235 213 bytes

“µ!æeıçȷ&#ð%ø&$dɓeñe÷Ɲ$Ƥ&ɓ'¤"' 'dd%dẎeȤdƤƬddƲdƝ‘s2⁴+Ɱ23¤żẎṣjƭƒ“Ç=ÇgƲ'€$fȤeƲ€fƈiÆf¿fÐɦÇ!×Çe2jÑþµþ¿g8i€þµþ½%4Ɲ5Ɲ2fƲ××½Ʋ;#½f¿f½Ʋ5¤6Ʋ€g¬g½i¬ⱮvØØØḳƁḳÞÞÞⱮpœßßßdœ⁾œŒŒŒdœ⁾¤o‘b50U+Ø0U‘Œṙṁ1xⱮ“&ðẏṪ¶ẏ×Ṙ⁷Ƈ⁾1Ẓṁn#’b64¤¤ị“ *#.-”Y

Try it online!

Uses a combination of run-length encoding and replacement of common length-2 sequences with a single digit. Does not use any standard compression library like gzip. Overall has 169 bytes of compressed data and 44 of code.

Explanation

Step 1: replace values in the data between 17 and 39 with prestored pairs of bytes

“µ...Ɲ‘                     | Base-250 integer list 9, 33, 22, 101, 25, 23, 26, 38, 35, 24, 37, 29, 38, 36, 100, 155, 101, 27, 101, 28, 150, 36, 151, 38, 155, 39, 3, 34, 39, 32, 39, 100, 100, 37, 100, 209, 101, 154, 100, 151, 152, 100, 100, 153, 100, 150
       s2                   | Split into twos
             ¤ż             | Zip the following as a nilad with this:
         ⁴                  | - 16
          +Ɱ23               | - Add this to implicit range from 1 to 23
             Ẏ              | Tighten (join outermost lists)
                   ƒ“Ç...o‘ | Reduce using the following, and starting with the base-250 integer list 14, 61, 14, 103, 153, 39, 12, 36, 102, 154, 101, 153, 12, 102, 156, 105, 13, 102, 11, 102, 15, 160, 14, 33, 17, 14, 101, 50, 106, 16, 31, 9, 31, 11, 103, 56, 105, 12, 31, 9, 31, 10, 37, 52, 150, 53, 150, 50, 102, 153, 17, 17, 10, 153, 59, 35, 10, 102, 11, 102, 10, 153, 53, 3, 54, 153, 12, 103, 7, 103, 10, 105, 7, 149, 118, 18, 18, 18, 217, 143, 217, 20, 20, 20, 149, 112, 30, 21, 21, 21, 100, 30, 142, 30, 19, 19, 19, 100, 30, 142, 3, 111
                  ƭ         | - Alternate between:
                ṣ           |   - Splitting
                 j          |   - And joining

Step 2: Run-length decode and convert to string

b50                                 | Convert to base 50
   U                                | Reverse order of bytes
    +Ø0                             | Add 0,0
       U                            | Reverse order again (effectively the last three links add in leading zeros where needed)
        ‘                           | Increment by 1
         Œṙ                         | Run length decode
           ṁ            ¤           | Mould like the following as a nilad:
            1xⱮ        ¤            | - 1 repeated each of the following as a nilad:
             “&...#’                |   - Base-250 integer 36418435425519061363927141799858777786
                    b64             |   - Convert to base 64
                         ị“ *#.-”   | Index into " *#.-"
                                 Y  | Join ith newlines
\$\endgroup\$
7
\$\begingroup\$

LaTeX, 452 448 bytes

Created with bigram replacement (and one trigram) instead of programming a loop to replace multiple consecutive symbols.

\newlinechar`+\def~#1{\catcode`#1=13\lccode`~=`#1\lowercase{\def~}}~$#1#2{~#1{#2#2}}~l#1#2#3{~#1{#2#3}}\catcode`#=12$_*$[_$]{ }$^]$!^$<#$><$=>$&=$@.$:@$)-$()$?($/&lx#.$;xl'#@l"<#l`!^l|!]lv#+lc:@lw><lk#:lh`]lg'.lf.#lq#|ld<:lr<@lnfc~s{?)v}la/=li'klj^#l,js\typeout{h [[[+h >:x+` '":.d+` "c.wh"`"+!!:c.h gqgvh <*>"!! ;q;v`>[_*w` ;q;v| @f_*.[.*":|gqgv| :[[_d.| "`"+| :[^[*:+` >!>+| w!w+/&=w+g#cxrnxrnx<?sa"?sikrkkrkk&>va<,kndn<:n#,a<,xi'<.i'<.i'#,a<^=>}

LaTeX, 506 bytes

Most likely there will be a more efficient variant, but this is what I managed to get by hand (no built in compression tools in LaTeX...). I created a small loop to replace consecutive sequences.

\def\|{\catcode`}\def~#1{\|#1=13\lccode`~=`#1\lowercase{\def~}}\| =12~@#1#2{\ifnum#1>0#2@{\numexpr#1-1}{#2}\fi}\|#=12~){@3}~({@4}~?{(.}~/{( }~<{@9  }~>{< }~_{>)#}~[{<#).#}~]{<#.#.#}~^{#).#@6.#.#}~!{#@{18}-#}~={@{42}#}~'{?}~&{#..#?#?#}~;{/#@9--#}~:{#@5.#@6.#}~"{#.#..#?#..#}\newlinechar`+\typeout{>/@{12}{*}+>/(#?#.+>  #..)#@5.##?+>  )#@7.@6#) _ _+>@5 @{11}.@5 @2[+>/##*@7#@7 @2]+> (#@7*@6#) @2]+>).#)*.(*.*)#?@2[+>?@9**##@5._ _+>?(*/@5*?+>  (#@8 (#+>@6#@8 @6#+@{62}#+)^!+=!+)&@{20}#+=;+):;+=;+)";+=/@{12}#}

Terminal output (of both codes):

This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019) (preloaded format=pdf
latex)
 restricted \write18 enabled.
entering extended mode
(./mariocg.tex
LaTeX2e <2018-12-01>
               ************
               ####....#.
             #..###.....##....
             ###.......######              ###            ###
                ...........               #...#          #...#
               ##*#######                 #.#.#          #.#.#
            ####*******######             #.#.#          #.#.#
           ...#***.****.*###....          #...#          #...#
           ....**********##.....           ###            ###
           ....****    *****....
             ####        ####
           ######        ######
##############################################################
#...#......#.##...#......#.##...#......#.##------------------#
###########################################------------------#
#..#....#....##..#....#....##..#....#....#####################
##########################################    #----------#
#.....#......##.....#......##.....#......#    #----------#
##########################################    #----------#
#.#..#....#..##.#..#....#..##.#..#....#..#    #----------#
##########################################    ############
)
\$\endgroup\$
5
\$\begingroup\$

Bash + coreutils + xz, 243 242 240 bytes

base64 -d<<<4AROAJpdABBtAVsJZEAxAEVT46Z4yzQSDRh1V2s3yKKQ3CiFBCqNr55BVH/f7Qz/mkCIrVe+i4qcFSY5BEjUGbKH55TbsFibiXAoQ8LLpf0KeeR/Qj+UVG3Y3+Xx/Xt+0BI+rKPZCnr2NYt5PB4YsQBJeHbN+TCDB9VxVA5l2MZerD23kdk9GwTt9T7j2LGzPwyNGnq9XrJxWS3PWQOEtp8A|xz -qdFraw
\$\endgroup\$
  • 1
    \$\begingroup\$ The double quotes are not necessary. \$\endgroup\$ – TheSola10 Sep 14 at 16:53
  • \$\begingroup\$ @TheSola10 Thanks! Saved 2 bytes. \$\endgroup\$ – David Conrad Sep 15 at 19:15
4
\$\begingroup\$

Keg, 2204 1012 745 bytes

(35*| )(34*|\*)\
(35*| )(4|\#)(4|\.)\#\.\
(35*| )\#\.\.(3|\#)(5|\.)\#\#(4|\.)\
(76+| )(3|\#)(7|\.)(6|\#)  (2|(34*| )(3|\#))\
(82*| )(65+|\.)(5| )(2|(91+| )\#(3|\.)\#)\
(35*| )\#\#\*(7|\#)(7| )(2|(91+| )\#\.\#\.\#)\
(34*| )(4|\#)(7|\*)(6|\#)   (2|(91+| )\#\.\#\.\#)\
(65+| )(3|\.)\#(3|\*)\.(4|\*)\.\*(3|\#)(4|\.)(2|(91+| )\#(3|\.)\#)\
(65+| )(4|\.)(91+|\*)\#\#(5|\.)(65+| )(3|\#)(34*| )(3|\#)\
(65+| )(4|\.)(4|\*)    (5|\*)(4|\.)\
     (2|(8| )(4|\#))\
   (2|(8| )(6|\#))\
(88*2-|\#)\
(3|\#(3|\.)\#(6|\.)\#\.\#)\#(92*|\-)\#\
(67*1+|\#)(92*|\-)\#\
(3|\#\.\.\#(4|\.)\#(4|\.)\#)(54*|\#)\
(67*|\#)    \#(91+|\-)\#\
(3|\#(5|\.)\#(6|\.)\#)    \#(91+|\-)\#\
(67*|\#)    \#(91+|\-)\#\
(3|\#\.\#\.\.\#(4|\.)\#\.\.\#)    \#(91+|\-)\#\
(67*|\#)    (34*|\#)(

Try it online!

Saved 267 bytes thanks to @Sriotchilism O'Zaic

1012 byte program

(35*| )(34*|\*)\
(35*| )(4|\#)(4|\.)\#\.\
(35*| )\#(2|\.)(3|\#)(5|\.)(2|\#)(4|\.)\
(76+| )(3|\#)(7|\.)(6|\#)(72*| )(3|\#)(34*| )(3|\#)\
(82*| )(65+|\.)(35*| )\#(3|\.)\#(91+| )\#(3|\.)\#\
(35*| )(2|\#)\*(7|\#)(98+| )\#\.\#\.\#(91+| )\#\.\#\.\#\
(34*| )(4|\#)(7|\*)(6|\#)(76+| )\#\.\#\.\#(91+| )\#\.\#\.\#\
(65+| )(3|\.)\#(3|\*)\.(4|\*)\.\*(3|\#)(4|\.)(91+| )\#(3|\.)\#(91+| )\#(3|\.)\#\
(65+| )(4|\.)(91+|\*)(2|\#)(5|\.)(65+| )(3|\#)(34*| )(3|\#)\
(65+| )(4|\.)(4|\*)(4| )(5|\*)(4|\.)\
(67+| )(4|\#)(8| )(4|\#)\
(65+| )(6|\#)(8| )(6|\#)\
(88*2-|\#)\
\#(3|\.)\#(6|\.)\#\.(2|\#)(3|\.)\#(6|\.)\#\.(2|\#)(3|\.)\#(6|\.)\#\.(2|\#)(92*|\-)\#\
(67*1+|\#)(92*|\-)\#\
\#(2|\.)\#(4|\.)\#(4|\.)(2|\#)(2|\.)\#(4|\.)\#(4|\.)(2|\#)(2|\.)\#(4|\.)\#(4|\.)(37*|\#)\
(67*|\#)(4| )\#(91+|\-)\#\
\#(5|\.)\#(6|\.)(2|\#)(5|\.)\#(6|\.)(2|\#)(5|\.)\#(6|\.)\#(4| )\#(91+|\-)\#\
(67*|\#)(4| )\#(91+|\-)\#\
\#\.\#(2|\.)\#(4|\.)\#(2|\.)(2|\#)\.\#(2|\.)\#(4|\.)\#(2|\.)(2|\#)\.\#(2|\.)\#(4|\.)\#(2|\.)\#(4| )\#(91+|\-)\#\
(67*|\#)(4| )(34*|\#)

Try it online!

This is just a run-length encoding of the ascii picture but implemented in Keg

Old program

\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \*\*\*\*\*\*\*\*\*\*\*\*\
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \#\#\#\#\.\.\.\.\#\.\
\ \ \ \ \ \ \ \ \ \ \ \ \ \#\.\.\#\#\#\.\.\.\.\.\#\#\.\.\.\.\
\ \ \ \ \ \ \ \ \ \ \ \ \ \#\#\#\.\.\.\.\.\.\.\#\#\#\#\#\#\ \ \ \ \ \ \ \ \ \ \ \ \ \ \#\#\#\ \ \ \ \ \ \ \ \ \ \ \ \#\#\#\
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \.\.\.\.\.\.\.\.\.\.\.\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \#\.\.\.\#\ \ \ \ \ \ \ \ \ \ \#\.\.\.\#\
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \#\#\*\#\#\#\#\#\#\#\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \#\.\#\.\#\ \ \ \ \ \ \ \ \ \ \#\.\#\.\#\
\ \ \ \ \ \ \ \ \ \ \ \ \#\#\#\#\*\*\*\*\*\*\*\#\#\#\#\#\#\ \ \ \ \ \ \ \ \ \ \ \ \ \#\.\#\.\#\ \ \ \ \ \ \ \ \ \ \#\.\#\.\#\
\ \ \ \ \ \ \ \ \ \ \ \.\.\.\#\*\*\*\.\*\*\*\*\.\*\#\#\#\.\.\.\.\ \ \ \ \ \ \ \ \ \ \#\.\.\.\#\ \ \ \ \ \ \ \ \ \ \#\.\.\.\#\
\ \ \ \ \ \ \ \ \ \ \ \.\.\.\.\*\*\*\*\*\*\*\*\*\*\#\#\.\.\.\.\.\ \ \ \ \ \ \ \ \ \ \ \#\#\#\ \ \ \ \ \ \ \ \ \ \ \ \#\#\#\
\ \ \ \ \ \ \ \ \ \ \ \.\.\.\.\*\*\*\*\ \ \ \ \*\*\*\*\*\.\.\.\.\
\ \ \ \ \ \ \ \ \ \ \ \ \ \#\#\#\#\ \ \ \ \ \ \ \ \#\#\#\#\
\ \ \ \ \ \ \ \ \ \ \ \#\#\#\#\#\#\ \ \ \ \ \ \ \ \#\#\#\#\#\#\
\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\
\#\.\.\.\#\.\.\.\.\.\.\#\.\#\#\.\.\.\#\.\.\.\.\.\.\#\.\#\#\.\.\.\#\.\.\.\.\.\.\#\.\#\#\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\#\
\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\#\
\#\.\.\#\.\.\.\.\#\.\.\.\.\#\#\.\.\#\.\.\.\.\#\.\.\.\.\#\#\.\.\#\.\.\.\.\#\.\.\.\.\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\
\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\ \ \ \ \#\-\-\-\-\-\-\-\-\-\-\#\
\#\.\.\.\.\.\#\.\.\.\.\.\.\#\#\.\.\.\.\.\#\.\.\.\.\.\.\#\#\.\.\.\.\.\#\.\.\.\.\.\.\#\ \ \ \ \#\-\-\-\-\-\-\-\-\-\-\#\
\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\ \ \ \ \#\-\-\-\-\-\-\-\-\-\-\#\
\#\.\#\.\.\#\.\.\.\.\#\.\.\#\#\.\#\.\.\#\.\.\.\.\#\.\.\#\#\.\#\.\.\#\.\.\.\.\#\.\.\#\ \ \ \ \#\-\-\-\-\-\-\-\-\-\-\#\
\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\ \ \ \ \#\#\#\#\#\#\#\#\#\#\#\#

Try it online!

I know this probably won't win any competitions, but hey, it looks nice. Literally just escaping every character and printing it. I mean, it could be golfed, but don't you just love ascii art programs?

\$\endgroup\$
4
\$\begingroup\$

JavaScript (Node.js),  265  264 bytes

Saved 1 byte thanks to @Night2

Deflated.

_=>require('zlib').inflateRawSync(Buffer('pVJbDoAwCPvfKZb0b4nc/3jCRAWGOrN+qNiV8litDs2geKqCQQyQZ/inMnS8SpQRKSsYkoYw2la6ESuSpCEcq27IjPt5eDmCXFQ6jCTFl1yqYSW1/tAxzBcvp+9l6BCnJ3eqr6Wmi4H9LoHzLPNYQukd6k04bspjtA345Z7K1QDnPX2O0uKn0QcWnE13b9EoXXE1XeEtWnU12AE','base64'))+''

Try it online!


JavaScript (Node.js), 318 bytes

Consecutive string substitutions.

_=>[...`L=J00BP
FM1A46E.##3B
2G@;<9#7#:7#8.653*42-1.0 #`].reduce((s,c,i)=>s.split(Buffer([94-i])).join(c+`A= >9SOKQ< <N0#0H<> ?0C5;D3
13:498#653*42-1.0 #`[i]),`?T]=JT29#.\\A[O9\\[3.I?10#?0C779D.?TSYJT0*I#77 UBUJ2=8*I? UBUW3<8*.=.*[YYW9]8Z.K0#?0CK9=4=*9\\272WI7I
F;6I
AX3X3X@HV#@HA>>0L>0L>;2CVR>EZEZPRVRM^0<^0<^#RV462`)

Try it online!


JavaScript (ES7), 340 bytes

Crushed.

_=>[...'[{+SUPER~Mario!}]'+2**29].reduce((s,c)=>(l=s.split(c)).join(l.pop()),`U15555
U13#9#.~o#739}9~o397.28+S
18PP7.1ii
U13*2#18 a 335E28oa7}5.E.*39ii~P55E#9.8S~PEooE*P~o331+33~21+26r
#RRR00#6#00#
#[3[3[r#6]
9!9!9!]6]
#M3M3M#]6oor331o+9#P0{{{7..8U 6
2222r##E**]oo#0-#}.#!.97#+ iU#7}r2223a#}}U#}}~M}79#7~
8R7!.3E5*P77U11S3#8 3#+o {---[799`)

Try it online!

Or here:

console.log((

_=>[...'[{+SUPER~Mario!}]'+2**29].reduce((s,c)=>(l=s.split(c)).join(l.pop()),`U15555
U13#9#.~o#739}9~o397.28+S
18PP7.1ii
U13*2#18 a 335E28oa7}5.E.*39ii~P55E#9.8S~PEooE*P~o331+33~21+26r
#RRR00#6#00#
#[3[3[r#6]
9!9!9!]6]
#M3M3M#]6oor331o+9#P0{{{7..8U 6
2222r##E**]oo#0-#}.#!.97#+ iU#7}r2223a#}}U#}}~M}79#7~
8R7!.3E5*P77U11S3#8 3#+o {---[799`)

)())

\$\endgroup\$
4
\$\begingroup\$

C (gcc), 322 320 318 316 bytes

-2 bytes thanks to ceilingcat.

f(i,c){for(i=0;c="/<q/TDQAq-QBSERDq-SGV.S,Sq/!K/QCQ*QCQq/R1W/\"QAQAQ*QAQAQq,T7V-QAQAQ*QAQAQq+CQ3A4A1SD*QCQ*QCQq+D:RE+S,Sq+D4$5Dq-T(Tq+V(Vq____RqQCQFQARCQFQARCQFQARocQq__]ocQqQBQDQDRBQDQDRBQDQD_Vq__\\$QjQqQEQFREQFREQFQ$QjQq__\\$QjQqQAQBQDQBRAQBQDQBRAQBQDQBQ$QjQq__\\$\\"[i++];)for(;c--%16;)printf(L" *.#-\n"+c/16-2);}

Try it online!

\$\endgroup\$
4
\$\begingroup\$

Bash + coreutils, 269 262 261 Bytes

base64 -d <<<H4sICLN9e10CA01BUklPAKVSWw6AMAj73ymW9G+J3P94wkQFhjqzfqjYlfJYrQ7NoHiqgkEMkGf4pzJ0vEqUESkrGJKGMNpWuhErkqQhHKtuyIz7eXg5glxUOowkxZdcqmEltf7QMcwXL6fvZegQpyd3qq+lpouB/S6B8yzzWELpHepNOG7KY7QN+OWeytUA5z19jtLip9EHFpxNd2/RKF1xNV3hLVp1tWPaAR8+K1RPBAAA|gunzip

A bit trivial - nothing clever happening here. I'm not sure if I'm allowed to use gzip like this. If I'm not I have no doubt someone will shout at me.

(better if I remove pointless spaces/quotes)

Thanks to @manatwork for saving a byte

Try it online!

\$\endgroup\$
  • 1
    \$\begingroup\$ Digital Trauma's tip may help you reduce it a bit more. \$\endgroup\$ – manatwork Sep 13 at 13:53
  • \$\begingroup\$ @manatwork Thanks, that helped me optimize a byte out of my answer. \$\endgroup\$ – David Conrad Sep 13 at 15:06
  • 2
    \$\begingroup\$ You could drop the echo command and a pipe by making it base64 -d<<<...|gunzip \$\endgroup\$ – TheSola10 Sep 14 at 16:49
4
\$\begingroup\$

Python3, 921 916 752 751 539 534 476 bytes

And here's a mandatory fair version. I used a script to count the individual characters, should be identical:

w,s,d,r=' *.#'
m='--'
n=m*5
A=d*2
B=d*3
C=d*4
D=d*5
E=d*6
F=r*2
G=r*3
H=r*4
I=r*6
J=r*42
K=w*10
L=K+w
M=L+w
N=M+w
O=w*15
P=w*4
Q=w*8
R=d+r
S=r+R+R
T=B+r
U=r+T
V=r+A
W=r+d+F+T+E
X=r+C
Y=r+E+F+D
Z=R+A+X+V
a=r+P+r+n+r
b=J+P+r
c=F+A+X+X
e=b+n+r
f=s*12
g=d*7
h=s*3
j=s*4
k=r*62
l=m*9
o=r*11
p=r*21
z='\n'
for i in"OfzOHCrdzNVGDFCzNGgINwGMGzOwDEOUKUzOFsGHNPSKSzMHhjINSKSzLThdjdsGCKUKUzLCjhhFDLGMGzLCjPjsCzNHQHzLIQIzkzUEWWrdFlrzJrlrzVXXccpzezrDYYrEazezrZFZFZazboz":print(end=eval(i))

Try it online!

Courtesy of the awesome guys in the comments that are much better than me!

And here's the (python3) script for any others who might want to generate some code and are too lazy/efficient to count manually:

mario = '''
               ************
               ####....#.
             #..###.....##....
             ###.......######              ###            ###
                ...........               #...#          #...#
               ##*#######                 #.#.#          #.#.#
            ####*******######             #.#.#          #.#.#
           ...#***.****.*###....          #...#          #...#
           ....**********##.....           ###            ###
           ....****    *****....
             ####        ####
           ######        ######
##############################################################
#...#......#.##...#......#.##...#......#.##------------------#
###########################################------------------#
#..#....#....##..#....#....##..#....#....#####################
##########################################    #----------#
#.....#......##.....#......##.....#......#    #----------#
##########################################    #----------#
#.#..#....#..##.#..#....#..##.#..#....#..#    #----------#
##########################################    ############
'''

curr_char = ""
count = 0
for i in mario:
    if i == curr_char:
        count += 1
    else:
        if curr_char != '\n':

            if curr_char == ' ':
                curr_char = 'w'
            elif curr_char == '#':
                curr_char = 'r'
            elif curr_char == ".":
                curr_char = "d"
            elif curr_char == "-":
                curr_char = "m"
            elif curr_char == '*':
                curr_char = 's'

            print(curr_char + '*' + str(count), end="+")
        else:
            print(",", end="")

        curr_char = i
        count = 1

Python3 loophole abused, 167 bytes

Since nothing was said about standard loopholes, I'll sneak this one in here while I can. TIO doesn't like urllib for some reason, if anyone knows a site to host the script on please tell me to. Obviously a link shortener could save some bytes, but I didn't want to go down that rabbit-hole any further.

from urllib.request import *
import re
print(re.split("</?code>",str(urlopen("https://codegolf.stackexchange.com/q/192715/85978").read()))[1].replace("\\n","\n")[:-1])
\$\endgroup\$
  • 12
    \$\begingroup\$ I'm pretty sure the point about standard loopholes is that they apply even when not explicitly mentioned. \$\endgroup\$ – ar4093 Sep 13 at 11:11
  • 1
    \$\begingroup\$ Yes, I agree; but since op said many people, including me and my friend, are interested about how to solve this problem within the fewest characters, I thought it might be worth a good laugh; which kind of fits the recreational programming theme of this post and parts of this site. \$\endgroup\$ – jaaq Sep 13 at 11:14
  • 1
    \$\begingroup\$ Then just take the text as input and use print(input()) \$\endgroup\$ – ar4093 Sep 13 at 11:15
  • 1
    \$\begingroup\$ Well, then I'd count the input towards the bytes used, since it'd defeat the entire challenge. I just wanted to play a bit with the 'programmers should never redo what is already out there' trope. Sorry if my mentality of just having fun in this environment bothers you, I didn't mean to at all! \$\endgroup\$ – jaaq Sep 13 at 11:17
  • 2
    \$\begingroup\$ I don't know python, but can you make m equal two dashes since every usage of dash is an even number? If so, you can save about 5 characters. \$\endgroup\$ – Keeta Sep 13 at 12:44
4
\$\begingroup\$

MarioLANG, 3287 3286 3285 Bytes

I had to do this for the theme.

+++++++++++++++++++++++++++++++++++++++++++++)++++++++++++++++++++++++++++++++)+++++++++++++++++++++++++++++++++++)++++++++++++++++++++++++++++++++++++++++++++++)++++++++++)++++++++++++++++++++++++++++++++++++++++++((((...............))))...........(.(((...............)....)....(.).).(((.............).)..(...).....(..)....).(((.............)...).......(......(..............)...(............)...)).(((................))...........((...............).)...(.(..........).)...(.)).(((...............)..))).(((.......(.................).).(.).(.(..........).).(.).(.)).(((............)....))).......(((......(.............).).(.).(.(..........).).(.).(.)).(((...........))...(.)))...((.))....((.)).(((...)....((..........).)...(.(..........).)...(.)).(((...........))....))..........(((..).....((...........)...(............)...)).(((...........))....))....((((....))))....((.....).(((.............)....(........)....)).(((...........)......(........)......)).((..............................................................)).((.)...(.)......(.).(..)...(.)......(.).(..)...(.)......(.).(..((..................)).)).((...........................................((..................)).)).((.)..(.)....(.)....(..)..(.)....(.)....(..)..(.)....(.)....(.....................)).((..........................................(....).((..........)).)).((.).....(.)......(..).....(.)......(..).....(.)......(.(....).((..........)).)).((..........................................(....).((..........)).)).((.).(.)..(.)....(.)..(..).(.)..(.)....(.)..(..).(.)..(.)....(.)..(.(....).((..........)).)).((..........................................(....)...........
=========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================.

Try it online!

This is horrible and I'm very sorry. Loops can get really expensive (bytes wise) in MarioLANG if you're not smart about them and also I'd almost lost the will to live by the time I'd got this far so Mario literally just runs in a straight line, first setting 6 memory cells to the correct ASCII values, then switching between them to output in the right order. This can definitely be golfed down further and if you really hate yourself I highly suggest you give it a go.

(Saved one byte by deleting last equals (floor character) since Mario hits the last instruction as he falls even without it and another by realising that he could actually hit two instructions in the fall.)

5413 Bytes

+++++>)+++++++++)+++++++)++++++)++++++++)+++++++++)++((((((-[!)+))++)++(()...............)............)).(((...............(....(....).(.))))).(((.............(.(..)...(.....)..(....))))).(((.............(...(.......)......)..(((++>-)))............(...(([!)))))).(((................((...........)).....(((++>-)))..........(.(...).(([!)))))).(((...............(..)).((.......).......(((++>-)))..........(.(.).(.).(([!)))))).(((............(....)).......((......)...(((++>-)))..........(.(.).(.).(([!)))))).(((...........((...))(.))...(((.)))....(((.))).((...(....))..........(.(.).(.).)..........(.(.).(.).)))).(((...........((....)))..........((..(.....))...........(...)............(...)))).(((...........((....)))....(....).....(((....))))).(((.....(((++>-)))........(....(([!)))))).(((...(((++>-)))........(......(([!)))))).((((((+++++++>-))........(([!))......)))).((((((+++>-)).(...).(......).(.).(([!)).)))..................(((.)))).((((((+++++++>-))......(([!)).)))..................(((.)))).((((((+++>-)).(..).(....).(....).(([!(+++++>-)))....((([!))))))).((((((+++++++>-))......(([!)))....(.)))..........(((.)))).((((((+++>-)).(.....).(......).(([!)))....(.)))..........(((.)))).((((((+++++++>-))......(([!)))....(.)))..........(((.)))).((((((+++>-)).(.).(..).(....).(..).(([!)))....(.)))..........(((.)))).((((((+++++++>-))......(([!)))....(...........
====="=======================================================#========================================================================================================================================================================="=======================#==================================================="=========================#====================================================="===========================#====================================================="===========================#=================================================================================================================================================================================================================================================================="====================#=================="======================#===================="==============#======================"==========================#=============================================="============#=========================================="==========================#======"============#====================="============#========================================"========================#============================================"============#========================================"============================#============================================"============#==================.
     !                                                       <                                                                                                                                                                         !                       <                                                   !                         <                                                     !                           <                                                     !                           <                                                                                                                                                                                                                                                                  !                    <                  !                      <                    !              <                      !                          <                                              !            <                                          !                          <      !            <                     !            <                                        !                        <                                            !            <                                        !                            <                                            !            <
     #======================================================="                                                                                                                                                                         #======================="                                                   #========================="                                                     #==========================="                                                     #==========================="                                                                                                                                                                                                                                                                  #===================="                  #======================"                    #=============="                      #=========================="                                              #============"                                          #=========================="      #============"                     #============"                                        #========================"                                            #============"                                        #============================"                                            #============"

Try it online!

This is a port of The random guy's answer using Dennis's Brainfuck to MarioLANG converter making very minor changes to save a couple of bytes. While it's obviously much longer, it includes more features of the language and better shows how the language works so I thought I'd include it.

\$\endgroup\$
3
\$\begingroup\$

Pyth, 211 bytes

Xr9.HC.Z"xÚ]Á	Â@E%Q‚².NŠ[@‚^LI¦°Šñ¾$æ>A¼Ûƒx]Уcô 2Ìÿæ?&°sT	M3«DÊljbÝ/ɬ}Ì ÏÞ‘L¦&›¡%®R$èW+…mö>3Ž`!Wr¢“ê0-ü
{*÷KšjÎÇËáÂÏÒm*üúYÓ^	. Õ¯ŽÎ´Ó,æ†]ó« –ÎRäP¨ïB#ª5Cø®Þš?ÇǸz-vxË"<G6"
 .-*#

Try it online!

Compression method: Since there's only 6 characters, the space, newline as well as #.-*, replace each of these with a letter from a-f. Afterwards, run-length encode the whole thing (aaaaaccc -> 5a3c etc.), then compress using zlib.

Xr9.HC.Z"..."<G6"\n .-*#"  # Complete program (last " is implicit)
        "..."              # zlib-compressed string
      .Z                   # decompress
     C                     # read that as a base 256 integer
   .H                      # convert to hex string
 r9                        # run-length decode
X            <G6"\n .-*#"  # translate "abcdef" to "\n .-*#"

The compressed string is

      _0 _1 _2 _3  _4 _5 _6 _7  _8 _9 _a _b  _c _d _e _f

000_  78 da 5d 8d  c1 09 c2 40  10 45 0b 10  25 51 82 b2
001_  2e 4e 01 8a  5b 40 82 0b  5e 13 4c 01  49 07 a6 07
002_  0b b0 8a 05  f1 be 24 e6  3e 41 bc db  83 78 1f 5d
003_  d0 a3 63 f4  20 32 cc ff  1f e6 3f 26  b0 73 11 54
004_  0e 09 4d 08  33 9d ab 44  0c ca c7 89  62 dd 2f c9

005_  ac 7d cc 20  02 cf de 91  4c a6 26 9b  a1 25 ae 52
006_  07 24 8f e8  57 8f 2b 85  6d f6 3e 07  33 8e 60 21
007_  57 72 a2 93  16 ea 30 2d  fc 0a 7b 2a  f7 4b 9a 6a
008_  ce c7 cb e1  c2 cf d2 6d  2a fc fa 59  d3 5e 09 2e

009_  15 20 d5 af  8e ce b4 d3  2c e6 86 0e  5d f3 ab 20
00a_  96 ce 52 17  04 e4 50 a8  ef 42 0c 1e  23 aa 35 43
00b_  f8 ae de 9a  3f c7 0f c7  b8 7a 01 2d  76 78 cb
\$\endgroup\$
3
\$\begingroup\$

Bash, 486 bytes

a=#.#.#O#.#.#
b=#e#O#e#
c=I#w#
S="Tb
T3f#.
R#d2g1f
R2i5S2Q2
UmT$b
T1*6V$a
Q3]5R$a
Pe#Y.Z.*2fO$b
Pf\`1gP2Q2
PfZI[f
R3M3
P5M5
EEA
#e#h#.1e#h#.1e#h#.1wu#
EDwu#
#d#f#f1d#f#f1d#f#fD
EC$c
#g#h1g#h1g#h#$c
EC$c
#.#d#f#d1.#d#f#d1.#d#f#d#$c
ECI;"
p(){
for((i=$[d-$2];i>0;i--)){ printf "$1";}
}
IFS=
while read -r -d '' -n1 c;do
printf -vd %d "'$c"
[ $d -le 47 ]&&printf "$c"||[ $d -le 69 ]&&p '#' 47||[ $d -le 86 ]&&p ' ' 69||[ $d -le 98 ]&&p '*' 86||[ $d -le 109 ]&&p '.' 98||p '-' 109
done<<<$S

Try it online!

The Run-Length Encoded string $S generated by the non-golfed program here: Try it online!

Then variables $a,$b,$c in $S were substituted by manual inspection, and a single back-tick had to be escaped in $S to allow variables to be used.

\$\endgroup\$
3
\$\begingroup\$

Perl, 422 396 370 366 365 characters

print"f c*
f 4#4.#.
d #..3#5.##4.
d 3#7.6#e 3#c 3#
10 b.f #3.#a #3.#
f ##*7#11 2<#.>#a 2<#.>#
c 4#7*6#d 2<#.>#a 2<#.>#
b 3.#3*.4*.*3#4.2<a #3.#>
b 4.a*##5.b 3#c 3#
b 4.4*4 5*4.
d 4#8 4#
b 6#8 6#
3e#
3<#3.#6.#.#>#12-#
2b#12-#
2<#..#4.#4.#>#.2<.#4>.15#
2a#4 #a-#
3<#5.#6.#>4 #a-#
2a#4 #a-#
3<#.#..#4.#..#>4 #a-#
2a#4 c#"=~s/.<(.+?)>/$1x$&/ger=~s/\w+(.)/$1x hex$&/ger;

Run-length encoded in 2 steps: consecutive characters and consecutive patterns of multiple characters.

Try it online!

\$\endgroup\$
2
\$\begingroup\$

PHP, 608 565 557 bytes

Uses GMP, the 5kJvr... string was created by first using substitutions to convert the original to base 5 6, then GMP to convert to base 62.

<?=str_replace(range(0,5),str_split("\n-.#* "),gmp_strval(gmp_init('5kJvrGbxP8CrM96cfgUaH1i7H5NT19NW3eSlwbRNO6MzND4omDb8BkvVwnTb1bQtCr6pet0EVt9BQnTuRSwcrL1Gnzs6dMEKAPctFQDrnbXv3eIzlyPYhZpGTwostpxBRJa7bvJvVVgoVjErM9sLKVxa0YkOaOUgMAP6orzz4ZGzb5iQ4qGDDuUOEiKmrcGTHp58srEheAqQSRQE4dOMlauXH4i06DY6tY8gu4maD2BFa68FA7s9sQG9VplFHpecaduYnzLoZgz18xwunIlSkFyIFCUyVMgVxvN7wxtyFZZSAli6DRyV1EobXZtiRa60mYyIZTYL79x190EjhCRAlBM1Lk11FJCeOFkKpAYW8M1hzUpghKA07J31gHpvlkFFKA4dSXvoZwGPbcrGOsmcsi5GAbhB2MIJe9XJGrA7KcSeMfOdxany7HEcesx8oewhtlRHnwxmG8qu8WwA8fjm1S82LMGrq3t',62),6));

Run online.

\$\endgroup\$
2
\$\begingroup\$

Python3, 557 bytes

Run length encoded, then a few repeated substrings (spaces then three "#", "-" surrounded by blocks, etc) manually extracted. Definitely room for improvement

u,v,w,x,y,z="*.-#\n "
t=z*4
s=x+w*18+x
r=t+x+w*10+x+y
q=x+v*3+x+v*6+x+v+x
p=x+v*2+x+v*4+x+v*4+x
o=x+v*5+x+v*6+x
n=x+v+x+v*2+x+v*4+x+v*2+x
m=z*10+x+v+x+v+x
l=z*10+x+v*3+x
print(t*4+u*12+y+z*15+x*4+v*4+x+v+y+z*13+x+v*2+x*3+v*5+x*2+v*4+y+z*13+x*3+v*7+x*6+z*14+x*3+t*3+x*3+y+t*4+v*11+z*5+l*2+y+z*15+x*2+u+x*7+z*7+m*2+y+t*3+x*4+u*7+x*6+z*3+m*2+y+z*11+v*3+x+u*3+v+u*4+v+u+x*3+v*4+l*2+y+z*11+v*4+u*10+x*2+v*5+z*11+x*3+t*3+x*3+y+z*11+v*4+u*4+t+u*5+v*4+y+z*13+x*4+t*2+x*4+y+z*11+x*6+t*2+x*6+y+x*62+y+q*3+s+y+x*42+s+y+p*3+x*20+y+x*42+r+o*3+r+x*42+r+n*3+r+x*42+t+x*11)

Python3, 789 bytes

Fun with random number generators. The image is run length encoded, then broken into chunks of 6. The first chunk (indices for the symbol to print) is generated from a pseudo-random number generator. The second is a base64 encoding of the 6 numbers.

from random import*
for a,b in zip([24743,129678,6328,31748,115,39591,43781,6080,105810,23721,53737,47694,64624,41381,26725,50462,13767,37213,119081,62980,29054,29054,29054,88178,27000,29054,29054,22423,17293,29054,53737,4887,17293,29054,29054,29054,53737,4887],[4366013200,2167672897,13976478019,12938928579,1328349251,1124376643,18371322817,10754461761,1090785345,1293447436,1241780289,11828203585,1141125187,3240640705,1091310209,11895611659,4479791875,13976490244,6627279364,1106776456,2164547651,2164547651,2164547651,1387008082,1141121089,1141121156,1141121156,1151866180,1157894218,2248429702,1141137477,1151864906,1090785354,2181316674,1141121089,1107562626,1141121092,11889283146]):
    seed(a)
    while b:
        b,i=divmod(b,64)
        print(" \n#-.*"[randrange(6)]*i,end="")
\$\endgroup\$
  • 1
    \$\begingroup\$ Instead of having newline stored in a variable you can use print(line1,line2,...,sep='\n') \$\endgroup\$ – ovs Sep 15 at 19:48
2
\$\begingroup\$

C, 1142 1068 1044 bytes

It's not very good, but I made it. Basically, I went line by line and any place one function plus two or more function calls was shorter than the original text, I replaced the text with a function.

s=32;a=42;h=35;d=46;m=45;p(c,n){while(n--){putchar(c);}}n(){puts("");}c(){printf("#.#.#");}o(){printf("#...#");}z(){p(m,18);p(h,1);n();}x(char*c){printf("%s",c);}y(){p(h,42);x("    #----------#\n");}main(){p(s,15);p(a,12);n();p(s,15);x("####....#.\n");p(s,13);x("#..###.....##....\n");p(s,13);p(h,3);p(d,7);p(h,6);p(s,14);p(h,3);p(s,12);p(h,3);n();p(s,16);p(d,11);p(s,15);o();p(s,10);o();n();p(s,15);p(h,2);p(a,1);p(h,7);p(s,17);c();p(s,10);c();n();p(s,12);p(h,4);p(a,7);p(h,6);p(s,13);c();p(s,10);c();n();p(s,11);x("...#***.****.*###....");p(s,10);o();p(s,10);o();n();p(s,11);x("....**********##.....");p(s,11);p(h,3);p(s,12);p(h,3);n();p(s,11);x("....****    *****....\n");p(s,13);p(h,4);p(s,8);p(h,4);n();p(s,11);p(h,6);p(s,8);p(h,6);n();p(h,62);n();o();x("......#.##...#......#.##...#......#.##");z();p(h,43);z();x("#..#....#....##..#....#....##..#....#....");p(h,21);n();y();x("#.....#......##.....#......##.....#......#    #----------#\n");y();x("#.#..#....#..##.#..#....#..##.#..#....#..#    #----------#\n");p(h,42);p(s,4);p(h,12);n();}

It saves 99 bytes over just using straight printf.

Saved 69 bytes by removing int and void specifiers, and the #include <stdio>. Saved another 2 bytes by declaring i as global instead of in the for loop. Saved another 3 bytes changing printf to putchar in two places. Removed another 21 bytes with changes suggested by @Christian Gibbons: Removed variable declarations at the beginning, changed the for loop to a decrementing while loop, changed '\n' to 10 in the n() function. Saved another 3 bytes changing putchar(10) to puts(""), courtesy of this answer.

1143 bytes

main(){printf("               ************\n               ####....#.\n             #..###.....##....\n             ###.......######              ###            ###\n                ...........               #...#          #...#\n               ##*#######                 #.#.#          #.#.#\n            ####*******######             #.#.#          #.#.#\n           ...#***.****.*###....          #...#          #...#\n           ....**********##.....           ###            ###\n           ....****    *****....\n             ####        ####\n           ######        ######\n##############################################################\n#...#......#.##...#......#.##...#......#.##------------------#\n###########################################------------------#\n#..#....#....##..#....#....##..#....#....#####################\n##########################################    #----------#\n#.....#......##.....#......##.....#......#    #----------#\n##########################################    #----------#\n#.#..#....#..##.#..#....#..##.#..#....#..#    #----------#\n##########################################    ############\n");}

Try it online here.

Ungolfed (ish)

s=32;a=42;h=35;d=46;m=45; // ASCII indices of (space) * # . - symbols.
p(c,n){ // Prints c, n times.
    while(n--){
        putchar(c);}}
n(){ // Prints a newline.
    puts("");}
c(){ // Prints a piece of the coins. Used 4 times.
    printf("#.#.#");}
o(){ // Prints a piece of the coins, and the ground. Used 5 times.
    printf("#...#");}
z(){ // Prints a piece of the ground. Used twice.
    p(m,18);;p(h,1);n();}
x(char*c){ // Wrapper for printf. Used 10 times.
    printf("%s",c);}
y(){ // Prints a piece of the ground. Used twice.
    p(h,42);x("    #----------#\n");}
main(){
    p(s,15);p(a,12);n();
    p(s,15);x("####....#.\n");
    p(s,13);x("#..###.....##....\n");
    p(s,13);p(h,3);p(d,7);p(h,6);p(s,14);p(h,3);p(s,12);p(h,3);n();
    p(s,16);p(d,11);p(s,15);o();p(s,10);o();n();
    p(s,15);p(h,2);p(a,1);p(h,7);p(s,17);c();p(s,10);c();n();
    p(s,12);p(h,4);p(a,7);p(h,6);p(s,13);c();p(s,10);c();n();
    p(s,11);x("...#***.****.*###....");p(s,10);o();p(s,10);o();n();
    p(s,11);x("....**********##.....");p(s,11);p(h,3);p(s,12);p(h,3);n();
    p(s,11);x("....****    *****....\n");
    p(s,13);p(h,4);p(s,8);p(h,4);n();
    p(s,11);p(h,6);p(s,8);p(h,6);n();
    p(h,62);n();
    o();x("......#.##...#......#.##...#......#.##");z();
    p(h,43);z();
    x("#..#....#....##..#....#....##..#....#....");p(h,21);n();
    y();x("#.....#......##.....#......##.....#......#    #----------#\n");
    y();x("#.#..#....#..##.#..#....#..##.#..#....#..#    #----------#\n");
    p(h,42);p(s,4);p(h,12);n();}
\$\endgroup\$
  • \$\begingroup\$ You can golf a bit more with some simple changes. Remove s,a,h,d,m, from the beginning, those will be implicitly declared as ints when you initialize them immediately afterwards. for(;i++>n;) will allow you to avoid writing i again within the loop. putchar('\n') -> putchar(10) to shave a couple more bytes. Also looks like you've got an extraneous ; in your z function. \$\endgroup\$ – Christian Gibbons Sep 13 at 20:13
  • \$\begingroup\$ actually, we can dump i altogether. Instead of a for-loop, do while(n--) \$\endgroup\$ – Christian Gibbons Sep 13 at 20:23
  • \$\begingroup\$ @ChristianGibbons: Thanks. I think that saved 21 bytes. Too bad it's still over three times the size of that other C answer. \$\endgroup\$ – MichaelS Sep 14 at 4:03
  • \$\begingroup\$ Moving x() to the top, you can have c() and o() call it to save some bytes. x() itself can take int*, since all pointers tend to have the same size, and print using printf(c) to save a few more bytes. Two functions can be shortened somewhat: n(){p(10,1);} and p(c,n){while(n--)x(&c);} (assumes little endian). Any time you call a function without an argument, you can use the previous function call as an argument, like so: c();n(); --> n(c());. \$\endgroup\$ – gastropner Sep 16 at 20:45
  • \$\begingroup\$ Building on @gastropner 987 bytes \$\endgroup\$ – ceilingcat Oct 17 at 2:18
2
\$\begingroup\$

Python, 340 378 bytes

I messed up the encoding in the original answer, here's one based on LZW compression. Might revisit my original answer at some point.

n=0
for c in'"/AVHF`N.o,>D\\5:{/RD?{C._Q\\%r7,SUOXGh8<}nA^Qddb<=Vb7;L@QPi[XJ65W=p|@<fxMl2+C1gro(x%m"Iz0+B?9d</tYaj.!:6(T#_/5el1Hl{[W&g*A.Oc1*4zf#[{WfLr@Km_jgFkg#1D`&Ik9r\'{M]7c&# X1,U#]=>}JFwVexi7nzbKnS-@-y{IA=l#="EVj=8L`%"9w@zoc9!:q/rT\\OMd]/p^ksiT?P_yj,':n=n*94+ord(c)-32
d=[*' *\n#.-']
s=c=' '
while n:i=n%202;d+=[c+(i>=len(d)and c[0]or d[i][0])];c=d[i];s+=c;n//=202
print(s)

Try it online!

\$\endgroup\$
  • 1
    \$\begingroup\$ This one isn't correct, you're missing 16 characters in the last line of the output. \$\endgroup\$ – Skillmon Sep 14 at 18:54
  • \$\begingroup\$ @Skillmon Thanks, updated with a working answer. \$\endgroup\$ – Kyle Gullion Sep 14 at 19:14
2
\$\begingroup\$

Pure JavaScript 419 bytes (no lib)

Compression (1 step: count each char in hex e.g. ********** gives *a, 2 step: convert two chars like *1 or #4 to single char witch free ascii code)

let d=`               ************
               ####....#.
             #..###.....##....
             ###.......######              ###            ###
                ...........               #...#          #...#
               ##*#######                 #.#.#          #.#.#
            ####*******######             #.#.#          #.#.#
           ...#***.****.*###....          #...#          #...#
           ....**********##.....           ###            ###
           ....****    *****....
             ####        ####
           ######        ######
##############################################################
#...#......#.##...#......#.##...#......#.##------------------#
###########################################------------------#
#..#....#....##..#....#....##..#....#....#####################
##########################################    #----------#
#.....#......##.....#......##.....#......#    #----------#
##########################################    #----------#
#.#..#....#..##.#..#....#..##.#..#....#..#    #----------#
##########################################    ############`
c=d.replace(/(.)\1*/g,(m, g)=>g+m.length.toString(16)).replace(/(.)([1-6])/g,(m,g,e)=>  String.fromCharCode(' .#-*'.indexOf(g)*6- -(e-1)+58))

console.log(c.length,c);

Decompression

c=` f*c
 fICF@
 dFAHDGC
 dH.7K eH cH
:0.b fFBF aFBF
 fGR#7:1F@F@F aF@F@F
 cI*7K dF@F@F aF@F@F
 bBFT@U@RHC aFBF aFBF
 bC*aGD bH cH
 bCU=VC
 dI 8I
 bK 8K
He
FBFEF@GBFEF@GBFEF@GL2F
GbL2F
FAFCFCGAFCFCGAFCFCF5
Ga=F-aF
FDFEGDFEGDFEF=F-aF
Ga=F-aF
F@FAFCFAG@FAFCFAG@FAFCFAF=F-aF
Ga=#c`
console.log(c.replace(/[:-Z]/g,m=>(z=m.charCodeAt(0)-58,' .#-*'[z/6|0]+(1+z%6))).replace(/([ #.\-*])([0-9a-f]+)/g,(m,g,e)=>g.repeat('0x'+e)))

\$\endgroup\$
2
\$\begingroup\$

PowerShell + tar, 265 = 9+256 bytes

This script works with Windows and Linux. The script extracts the output from the tar archive t (256 bytes). The t should be placed in the same directory as the script.

tar xOf t

Try it online!

The powershell script to create the tar archive t:

(@"
               ************
               ####....#.
             #..###.....##....
             ###.......######              ###            ###
                ...........               #...#          #...#
               ##*#######                 #.#.#          #.#.#
            ####*******######             #.#.#          #.#.#
           ...#***.****.*###....          #...#          #...#
           ....**********##.....           ###            ###
           ....****    *****....
             ####        ####
           ######        ######
##############################################################
#...#......#.##...#......#.##...#......#.##------------------#
###########################################------------------#
#..#....#....##..#....#....##..#....#....#####################
##########################################    #----------#
#.....#......##.....#......##.....#......#    #----------#
##########################################    #----------#
#.#..#....#..##.#..#....#..##.#..#....#..#    #----------#
##########################################    ############
"@) | Set-Content f -Force
tar zcfo t f
\$\endgroup\$
1
\$\begingroup\$

Perl with Filter:sh module, 672 bytes

It's long but it is also rather unreadable so I thought it qualifies as a golfing answer...

use Filter::sh 'sed "s/S/\" \"/g"';
use Filter::sh 'sed "s/\([0-9]\+\)/x\1 ./g"';
$e="....";$a="#...#$e..#.#";$b="#..#$e#$e#";$c="#$e.#$e..#";$d="#.#..#$e#..#";$f="###";$g="#...#";$h="#.#.#";
print S16"*"12"\n".S16'#'4'.'4"#.\n".S14"#..$f$e.##$e\n".S14$f."."7$f.$f.S13$f.S12"$f\n".S17"."11S14$g.S10"$g\n".S16"##*"."#"7S16$h.S10"$h\n".S13"$f#"."*"7"#"6S12$h.S10"$h\n".S12"...#***.****.*###$e".S9$g.S10"$g\n".S12$e."*"10"##$e.".S10$f.S12"$f\n".S12"$e****    ****$e\n".S14"$f#".S8"$f#\n".S12$f.$f.S8"$f$f\n"."#"62"\n$a$a$a#"."-"18"#\n"."#"43"-"18"#\n$b$b$b"."#"20"\n"."#"42S4"#"."-"10"#\n$c$c$c".S4"#"."-"10"#\n"."#"42S4"#"."-"10"#\n$d$d$d".S4"#"."-"10"#\n"."#"42S4"#"12"\n";

Explanation: the filter replaces S with " " and a number with x(num) ., so for example S14 becomes " "x14. In Perl this means "print a space 14 times". Furthermore there is some manual compression for sequences that occur often using variables $a-$h.

\$\endgroup\$
  • \$\begingroup\$ Why use sed commands when perl supports s/regex/replace/g syntax natively? \$\endgroup\$ – Score_Under Sep 16 at 9:08
  • \$\begingroup\$ @Score_Under that is because I didn't know about the e regex modifier that is needed here to execute the x operator after substitution - but now I do :D \$\endgroup\$ – Marijn Sep 16 at 10:15
1
\$\begingroup\$

SOGL V0.12, 971 bytes

I simply copied the whole string to the compressor. I realized that the string wasn't compressed a lot.

"ξ↔⁴‚σ╔↔æz½↓«ļ;¾⅝↑¶q$+ξρI#↔@≥Β⁄,;∆n2BΡ¾~«n▼og╤iCΘ⌠δZ░∑℮E3č─æ`⅓+↑žS]ķø 'αN²'Q-ω⅞±ž<e⁴Κ№6‼Dfθ∫⅞)i≠Ph╗8B‽`HΔ→┘↓d5∑∫h╤kΖΜY⅞|⌡Σχ¡GΥq«≡─ηe→°~⁹*░κRΝycč□±H⅔b¾℮╗↕Θ*ζΜ9⁵Dæqēυ¦Jn|¼▲ū-⁹¡╗;g²T℮F6u*ε¤3⅜v■└$}Q;▒MKηBqο⁰X╬/Lβ┌I╬č¤¾►'█p¹A0E∑QXγ9§čΡT▒ξ⁾n‚Υ∫æ¤3I-↕æA⁄gTq√šk3>‼μσ¤j:Zk►↓σ¾ņ*∑*╤ΚPn׀æS~3j‚~█fo╔Ε‼■¤υ ρ{¦Oτ◄μ`]ŗS▓κΜ4y║6AΨū0⁽:uMφ^υκ≤&/═;Ο≠№3→⁄Θ±ū<R°ω.cģ²⁴׀Kē~Θ60Εθ^Ε½rA┼═◄⅞║⁶jH²βX8ΓMOšι≤9#$XΚƨ]¶ļA¾⅛x▲Ε|F■¾ƨ(Υ5ΨB[↑√℮⅔α@↓ļ\TB⌠w⅝³βšīηo¤Ω¦∑CTΕņžAh′DαψH?¡ΙO‽HωΕ?○ƦΖ`∙²u   ⁶¾╚iļ⁶Π7⁾ρ℮░;(Ο²9⅔v○⌡⁽¾‽↑┼ξjƧ¬h¼┌Y▲¹ēhμΞ*⁴ā≠cmeeW℮ADC═¬[9išE⅛~№k⅔№lķ¼⅛∆$qΒR┐Γ¦⅔}\Φ‼ΩxøG⁾ΓOŗ⅟zψ;¹]m║░↔═;↑τΩÆΘχW»G∞ΧQT_L  Δ   nē‼№>ζƧρΕ↔Λλ↑EīšÆ↑gWIμū█⁹└Ιf⌡EΘ⁶cυ═<⅜LjΤlτ⅞⅟ΟB╚@░⁽ič-|dΘž⁽Υ■tPp⁵θ╝│⅜v+M8³Τ╝ι░╬¶ū¾oī⅜o╥\VΨΖ6±≡∆hl?ΦģīX╚æ→#%C\aG‛Ι⌠?ΞJ⁄═⁴v°±∫⁸dy►īι׀ģ&χeģ ~xš/L»ψ(Ξ]δ‛ģæ─╗ƨ╚a*‰■Υ□L$.Λ└≈′9ν‚v░¦+ΛξƧΟļBKγ÷Π*IΝ‚ρTGΜ-^gΗ?Æ[ā╤⅓c&►δæ↓°√>R%┘⁵ī╥$J▲kψβ▲Χ╝0ψγαp¾‼~γ!ι⅔_γψ⁄⅝┼═ģÆ⁴A»┼Jλ∆≤š'ΣRΡΩd4¬hAVb¬zbH⁸ωθyV»⁹№ξ╤*°Kν-G[═ζ∙εY↔⁾Xp⁷χ<⁹≈≈┐>°(Æ#¼i┌γδ∫+ευļDET⌡∆═ν<xzΘ⁰⌡hS»ΚKļ⁰G*mε▲GΖλDΗ_Ηx╝⁴ΘλLσ╝ψB~χ[Ν#ΗhΡ\λ2Y∙ψ¤i⌠}λ▒│αξqzP⅜¶²‘

Try it Here!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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