97
\$\begingroup\$

The challenge is actually extremely simple. Pick 5 distinct letters (you can just pick the 5 that allow you the shortest code if you like) and output them to the console. However, the twist is that they must be from the following list:

 AAA      BBBB       CCCC     DDDD      EEEEE     FFFFF      GGG      H   H
A   A     B   B     C         D   D     E         F         G         H   H
AAAAA     BBBB      C         D   D     EEEE      FFFF      G  GG     HHHHH
A   A     B   B     C         D   D     E         F         G   G     H   H
A   A     BBBB       CCCC     DDDD      EEEEE     F          GGG      H   H


IIIII         J     K   K     L         M   M     N   N      OOO 
  I           J     K  K      L         MM MM     NN  N     O   O
  I           J     KKK       L         M M M     N N N     O   O
  I       J   J     K  K      L         M   M     N  NN     O   O
IIIII      JJJ      K   K     LLLLL     M   M     N   N      OOO 


PPPP       QQQ      RRRR       SSSS     TTTTT     U   U     V   V     W   W
P   P     Q   Q     R   R     S           T       U   U     V   V     W   W
PPPP      Q   Q     RRRR       SSS        T       U   U     V   V     W   W
P         Q  QQ     R  R          S       T       U   U      V V      W W W
P          QQQQ     R   R     SSSS        T        UUU        V        W W 


X   X     Y   Y     ZZZZZ
 X X       Y Y         Z 
  X         Y         Z  
 X X        Y        Z   
X   X       Y       ZZZZZ

Additional Rules:

  • 5 of the same letter is not allowed, no repeat choices.
  • Each letter must use the capital of itself as the ascii-character to draw it.
  • Each letter output must be on the "same line" and have 5 spaces between each letter.
  • You may choose any 5 letters that you want, this will allow you to reuse some code and lower your byte count. Figuring out which letters will allow you to do this most efficiently is part of the challenge.
  • Trailing spaces are acceptable.
  • A single trailing newline is acceptable, no more than one trailing newline though.
  • This is code-golf, lowest byte-count wins.

Examples:

A B C D E

 AAA      BBBB       CCCC     DDDD      EEEEE
A   A     B   B     C         D   D     E    
AAAAA     BBBB      C         D   D     EEEE 
A   A     B   B     C         D   D     E    
A   A     BBBB       CCCC     DDDD      EEEEE

E F L I P

EEEEE     FFFFF     L         IIIII     PPPP 
E         F         L           I       P   P
EEEE      FFFF      L           I       PPPP 
E         F         L           I       P    
EEEEE     F         LLLLL     IIIII     P    

C R A Z Y

 CCCC     RRRR       AAA      ZZZZZ     Y   Y
C         R   R     A   A        Z       Y Y 
C         RRRR      AAAAA       Z         Y  
C         R  R      A   A      Z          Y  
 CCCC     R   R     A   A     ZZZZZ       Y  

Don't be afraid to submit more than one answer with different letters or different strategies each time, this can be accomplished various different ways.

\$\endgroup\$
10
  • 23
    \$\begingroup\$ I like that you get to choose which letters to output; that adds another layer to the golfing. Minor issues with the ASCII art: there's a ton of trailing spaces, and two Js. \$\endgroup\$ Commented Nov 15, 2016 at 15:16
  • 1
    \$\begingroup\$ @ETHproductions Rofl, the 2 J's got past both ME and the sandbox, fixing. \$\endgroup\$ Commented Nov 15, 2016 at 15:17
  • 2
    \$\begingroup\$ Can you add a bonus for taking 5 letters as input? \$\endgroup\$ Commented Nov 15, 2016 at 18:22
  • 7
    \$\begingroup\$ Bonuses are frowned upon and there are too many answers to make a drastic change such as that. But I will give you an upvote ;). \$\endgroup\$ Commented Nov 15, 2016 at 19:05
  • 1
    \$\begingroup\$ @Titus I don't know why you'd need them; trailing makes more sense. If you can logically explain how a limitation of the language you are using and not the logic you've written is causing a leading \n, I will allow it. \$\endgroup\$ Commented Nov 18, 2016 at 14:26

52 Answers 52

34
\$\begingroup\$

Charcoal, 51 49 bytes (ECXKI)

G←⁵↓³→⁴EM⁷→G↑²↗²→⁴CM⁶→GH↘↗³XM⁶→GH↓→↗³KM⁸→PTIII‖O↓

Outputs

EEEEE      CCCC     X   X     K   K     IIIII
E         C          X X      K  K        I  
EEEE      C           X       KKK         I  
E         C          X X      K  K        I  
EEEEE      CCCC     X   X     K   K     IIIII

Try it online!

Using characters that are vertically symmetrical, draws the top halves and then reflects. Most of these make use of Polygon () and PolygonHollow (GH) to draw a series of connected line segments with a particular character. I can more easily be done with MultiPrint (), using T as the direction.

Note: PolygonHollow just draws the segments specified, without completing the polygon or filling it. Polygon will complete and fill (not what we want) if the polygon can be completed with a simple line in one of the eight cardinal or intercardinal directions. Otherwise, it behaves like PolygonHollow, for a savings of one byte.

The order of characters was chosen to require only horizontal moves from the endpoint of one to the start of the next. Here's how the cursor proceeds:

Cursor movement, drawing top halves of ECXKI

\$\endgroup\$
2
  • 2
    \$\begingroup\$ Nice. I was trying a charcoal solution but the lack of documentation honestly killed me \$\endgroup\$ Commented Nov 16, 2016 at 8:43
  • 6
    \$\begingroup\$ @Bassdrop Yeah, we're... um... working on that. [goes to add GH to the docs] \$\endgroup\$
    – DLosc
    Commented Nov 16, 2016 at 16:31
19
\$\begingroup\$

PowerShell v2+, 138 128 114 112 106 105 bytes (LICTD)

"L1    IIIII1 CCCC1TTTTT1DDDD
$("L11 I1  C11 T1  D   D
"*3)LLLLL1IIIII1 CCCC1  T1  DDDD"-replace1,'     '

The idea is to maximize the spaces between the letters so we can get repeated compressions.

Borrows the middle-row deduplication trick from Florent's answer. Saved 6 bytes thanks to Ben Owen by using string multiplication for the middle three rows, and an additional byte thanks to Matt.

Output is like the following at 227 bytes, for a 53.7% reduction --

PS C:\Tools\Scripts\golfing> .\5-favorite-letters.ps1
L         IIIII      CCCC     TTTTT     DDDD
L           I       C           T       D   D
L           I       C           T       D   D
L           I       C           T       D   D
LLLLL     IIIII      CCCC       T       DDDD
\$\endgroup\$
3
  • \$\begingroup\$ I love it when the first answer is something you didn't expect at all. Neat method. \$\endgroup\$ Commented Nov 15, 2016 at 15:43
  • 2
    \$\begingroup\$ How about $("L11 I1 C11 T1 D D`n"*3) instead of the middle 3 lines \$\endgroup\$
    – Ben Owen
    Commented Nov 15, 2016 at 16:45
  • \$\begingroup\$ @BenOwen Excellent idea - thanks! \$\endgroup\$ Commented Nov 15, 2016 at 16:50
13
\$\begingroup\$

Jelly,  41  40 bytes

N.B. I have a 39 byte answer too.

LICTE

141D+“ȷɓSɠ’“ðƁ ƥ“JrŀṘ’jḃ11“LICTE”K¤żⱮŒṙY

TryItOnline!

Idea

Use a run length decode with letters that have as similar middle as possible with only one run length of each "pixel value" per row per letter.

Put a flat start like "L" to avoid different run length decode values for the rows.

Place the one different letter (could not find 5) of the three middle rows at the end so the smallest difference may be added arithmetically.

Output wanted; the run lengths; and these converted from base 11:

                                                  L,  , I,  , C,  , T,  , E   value
                                                  -------------------------
L         IIIII      CCCC     TTTTT     EEEEE     1, 9, 5, 6, 4, 5, 5, 5, 5   399633415
L           I       C           T       E         1,11, 1, 7, 1,11, 1, 7, 1   431646160+1
L           I       C           T       EEEE      1,11, 1, 7, 1,11, 1, 7, 4   431646160+4
L           I       C           T       E         1,11, 1, 7, 1,11, 1, 7, 1   431646160+1
LLLLL     IIIII      CCCC       T       EEEEE     5, 5, 5, 6, 4, 7, 1, 7, 5   1179122455

The three values 399633415, 431646160, and 1179122455 in base 250 as Jelly code page indices are then ðƁ ƥ, ȷɓSɠ, and JrŀṘ which can be used to encapsulate the run-length information.

The code

141D+“ȷɓSɠ’“ðƁ ƥ“JrŀṘ’jḃ11“LICTE”K¤żⱮŒṙY - Main link
141D                                     - 141 as a decimal list: [1, 4, 1]
     “ȷɓSɠ’                              - 431646160
    +                                    - add: [431646161, 431646164, 431646161]
           “ðƁ ƥ“JrŀṘ’                   - list [399633415,1179122455]
                      j                  - join: [399633415, 431646161, 431646164, 431646161, 1179122455]
                       ḃ11               - convert to bijective base 11: [[1, 9, 5, 6, 4, 5, 5, 5, 5], [1, 11, 1, 7, 1, 11, 1, 7, 1], [1, 11, 1, 7, 1, 11, 1, 7, 4], [1, 11, 1, 7, 1, 11, 1, 7, 1], [5, 5, 5, 6, 4, 7, 1, 7, 5]]
                                  ¤      - nilad followed by link(s) as a nilad:
                          “LICTE”        -   list of characters "LICTE"
                                 K       -   join with spaces   "L I C T E"
                                    Ɱ    - map across (the lists of numbers) applying:
                                   ż     -   zip             e.g. [['L',1],[' ',9],['I',5],[' ',6],['C',4],[' ',5],['T',5],[' ',5],['E',5]]
                                     Œṙ  - run-length decode e.g. "L         IIIII      CCCC     TTTTT     EEEEE"
                                       Y - join with line feeds
\$\endgroup\$
1
  • 1
    \$\begingroup\$ You did the idea I had initially that I was not smart enough to do in 05AB1E!!! Amazing job man. \$\endgroup\$ Commented Nov 15, 2016 at 19:04
13
\$\begingroup\$

PHP, 107 104 102 94 86 bytes

Ok I'm confident I have the smallest possible source with this method now. I wrote a script to generate and then gzip every possible combination of five letters. There are two solutions that match for the shortest compressed -- LODIC and LDOIC. I'm going with the former because it's more fun to say.

Source:

<?=gzinflate(base64_decode('81GAA39/fwjDBQggLE8QgDCdgYDLB6EYioGqoRisHkrTSCUIEOtWAA'));

Output:

% php foo.php
L          OOO      DDDD      IIIII      CCCC
L         O   O     D   D       I       C
L         O   O     D   D       I       C
L         O   O     D   D       I       C
LLLLL      OOO      DDDD      IIIII      CCCC
\$\endgroup\$
10
  • 3
    \$\begingroup\$ you can save 2 bytes by dropping the 's: the string will get treated as a constant with a value of itself. \$\endgroup\$
    – user59178
    Commented Nov 15, 2016 at 17:45
  • \$\begingroup\$ Damnit, I always forget to do that. :) \$\endgroup\$ Commented Nov 15, 2016 at 18:23
  • \$\begingroup\$ If L was your last letter you'd save more bytes too. \$\endgroup\$ Commented Nov 15, 2016 at 19:03
  • \$\begingroup\$ Nice exploiting of a loophole. \$\endgroup\$ Commented Nov 17, 2016 at 19:58
  • 2
    \$\begingroup\$ Creativity is subjective and immeasurable. The goal of the challenge is to minimize code size and this is the shortest entry for a non-golfing language. \$\endgroup\$ Commented Nov 22, 2016 at 18:35
13
\$\begingroup\$

JavaScript, 110 109 bytes (CLOUD)

` CCCC5L9 OOO6U3U5DDDD
${x=`C9L9O3O5U3U5D3D
`,x+x+x} CCCC5LLLLL6OOO7UUU6DDDD`.replace(/\d/g,c=>" ".repeat(c))

console.log(
` CCCC5L9 OOO6U3U5DDDD
${x=`C9L9O3O5U3U5D3D
`,x+x+x} CCCC5LLLLL6OOO7UUU6DDDD`.replace(/\d/g,c=>" ".repeat(c))
)

Output is 227 bytes:

 CCCC     L          OOO      U   U     DDDD
C         L         O   O     U   U     D   D
C         L         O   O     U   U     D   D
C         L         O   O     U   U     D   D
 CCCC     LLLLL      OOO       UUU      DDDD
\$\endgroup\$
2
  • 1
    \$\begingroup\$ Nice use of deduplication in the middle three rows. \$\endgroup\$ Commented Nov 15, 2016 at 16:21
  • \$\begingroup\$ Save 1 byte by using padEnd instead of repeat. i.e. "".padEnd(c) \$\endgroup\$ Commented Aug 7 at 6:24
12
\$\begingroup\$

ES6 (Javascript), 194, 181 bytes (IGOLF/ANY)

This one is long, and is not really optimized (not yet at least), but can be modified to print any particular message, by only changing the bitmap data.

EDIT: Replaced inner reduce with map, use bit shift for padding

Golfed

[0x1f73a1f,0x484610,0x49c61e,0x48c610,0x1f73bf0].map(r=>[0,1,2,3,4].map(p=>('0000'+(r>>(20-p*5)<<5).toString(2)).substr(-10).replace(/(1|0)/g,b=>' IGOLF'[(p+1)*b])).join``).join`\n`

Demo

[0x1f73a1f,0x484610,0x49c61e,0x48c610,0x1f73bf0].map(r=>[0,1,2,3,4].map(p=>('0000'+(r>>(20-p*5)<<5).toString(2)).substr(-10).replace(/(1|0)/g,b=>' IGOLF'[(p+1)*b])).join``).join`\n`

IIIII      GGG       OOO      L         FFFFF     
  I       G         O   O     L         F         
  I       G  GG     O   O     L         FFFF      
  I       G   G     O   O     L         F         
IIIII      GGG       OOO      LLLLL     F         

Theory

Take a letter:

IIIII      
  I        
  I        
  I        
IIIII 

convert it to binary matrix (bitmap)

11111
00100
00100
00100
11111

do the same for other 4 letters, scan a line, by taking "top" 5 bits off each

11111 01110 01110 10000 11111

convert to a hexadecimal string (should be using base36 or even printable ASCII here)

0x1f73a1f

apply the same algorithm to other 4 lines, to get the bitmap.

Render in the reverse order.

\$\endgroup\$
6
  • 1
    \$\begingroup\$ You can remove the parentheses in the regex to save 2 bytes :-) \$\endgroup\$ Commented Nov 16, 2016 at 0:04
  • 1
    \$\begingroup\$ [32979487,4736528,4834846,4769296,32979952] is shorter than its hexadecimal representation \$\endgroup\$
    – Florent
    Commented Nov 16, 2016 at 7:50
  • \$\begingroup\$ @ETHproductions True, will make use of this, when I'll be back to optimize it. Thx! \$\endgroup\$
    – zeppelin
    Commented Nov 16, 2016 at 8:32
  • 1
    \$\begingroup\$ You could replace /(1|0)/g by /\d/g to save a few bytes. Also \n could be replace by an actual new line. \$\endgroup\$
    – Florent
    Commented Nov 16, 2016 at 9:27
  • \$\begingroup\$ >is shorter than its hexadecimal representation Yep, that is true (due to 0x), at least for these specific letters, I'll probably compress this into a continuous hex (or even Base32/Base36/ASCII) string, on the next iteration. >You could replace /(1|0)/g by /\d/g to save a few bytes. Also \n could be replace by an actual new line. Yep, thank you for your tips, I will make use of them once I'm back to this one. \$\endgroup\$
    – zeppelin
    Commented Nov 16, 2016 at 19:19
10
\$\begingroup\$

05AB1E, 44 bytes

This was a fun one.
I feel like I need to come back and try and golf it some more when I have time.

Uses CP-1252 encoding.
Inspired by carusocomputing's answer.

ECOIH

‘ÓÑOIHH‘SðýJ3×S•Td<UÕ‘áÓ?¢tWvkÔÚ•S)øü×J3äû»

Try it online!

Explanation

‘ÓÑOIHH‘ pushes the string "ECOOIHH".

SðýJ3×S joins the string by spaces, repeats it thrice and converts it to a list.
The resulting list is ['E', ' ', 'C', ' ', 'O', ' ', 'O', ' ', 'I', ' ', 'H', ' ', 'H', 'E', ' ', 'C', ' ', 'O', ' ', 'O', ' ', 'I', ' ', 'H', ' ', 'H', 'E', ' ', 'C', ' ', 'O', ' ', 'O', ' ', 'I', ' ', 'H', ' ', 'H'].

•Td<UÕ‘áÓ?¢tWvkÔÚ• pushes the number 564631055513119191317171314619131717500.

S)ø zips the list and the number together.

ü×J does pairwise string repetition and joins them together.
The result is the string EEEEE CCCC OOO IIIII H HE C O O I H HEEEE C O O I HHHHH.

3äû»splits that into 3 pieces, adds the first and second piece in reverse order and joins by newlines.

\$\endgroup\$
5
  • 15
    \$\begingroup\$ "•Td<UÕ‘áÓ?¢tWvkÔÚ• pushes the number 564631055513119191317171314619131717500" because why wouldn't it... \$\endgroup\$ Commented Nov 16, 2016 at 10:58
  • 3
    \$\begingroup\$ @geisterfurz007: To be more precise, it's the base-214 representation of the base-10 number :) \$\endgroup\$
    – Emigna
    Commented Nov 16, 2016 at 11:10
  • \$\begingroup\$ So potentially if you could go up to a higher base, your string would get shorter? \$\endgroup\$ Commented Nov 16, 2016 at 11:12
  • \$\begingroup\$ @geisterfurz007: If we could yes. Unfortunately 214 is the max in 05AB1E. \$\endgroup\$
    – Emigna
    Commented Nov 16, 2016 at 11:25
  • 3
    \$\begingroup\$ You can beat Jelly, I believe in you; 3 bytes left to go haha! \$\endgroup\$ Commented Nov 16, 2016 at 17:33
9
\$\begingroup\$

JavaScript (ES6), 96 bytes (DIOCL)

`${x="DDDD6IIIII6OOO7CCCC5L"}
${y=`D3D7I7O3O5C9L
`,y+y+y+x}LLLL`.replace(/\d/g,d=>" ".repeat(d))

The idea here is to not only make the middle three lines identical, but also make the first line nearly identical to the last. Since there are only 4 letters that perfectly fit this description CDIO, L is the next best option, as it only requires 4 added characters at the end of the string.

As with Florent's answer, this is a snippet that returns the result. Add 3 bytes if it needs to be a function.

Test snippet

console.log(`${x="DDDD6IIIII6OOO7CCCC5L"}
${y=`D3D7I7O3O5C9L
`,y+y+y+x}LLLL`.replace(/\d/g,d=>" ".repeat(d)))

\$\endgroup\$
3
  • \$\begingroup\$ You can save a byte by putting the D first. \$\endgroup\$
    – Neil
    Commented Nov 16, 2016 at 11:12
  • \$\begingroup\$ @Neil Thanks. I had to move the C past the I and O as well \$\endgroup\$ Commented Nov 16, 2016 at 16:41
  • \$\begingroup\$ Ah, right, you can't have the I immediately after the C, although interestingly doing that improves my Batch solution, for the same reason. \$\endgroup\$
    – Neil
    Commented Nov 16, 2016 at 20:20
9
\$\begingroup\$

Bash+coreutils with figlet, 55440 solutions, 112 106 bytes each

 set H E L P D;for l;do figlet -f banner $l|sed "s/.//3;s/.//5;s/#/$l/g;2d;5d">$l;done;paste $@|expand -t10

Output:

H   H     EEEEE     L         PPPP      DDDD  
H   H     E         L         P   P     D   D 
HHHHH     EEEE      L         PPPP      D   D 
H   H     E         L         P         D   D 
H   H     EEEEE     LLLLL     P         DDDD  
                                              

Hey, we already have a program for ASCII art! The banner font almost does the job, except it outputs 7x7 letters. Hmm, let's just remove the 3rd and 5th columns, and the 2nd and 5th lines, and see what it gives...

It turns out that many letters will be output the required way, namely, B D E F H J L P T U Z.

It suffices to replace the arguments of the first set command with any combination of those letters to still obtain a correct result! Hence, this gives us 11*10*9*8*7=55440 solutions, each of those being 106 bytes long.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ My first thought when reading the challenge was "one has to use figlet to solve this" \$\endgroup\$
    – THC
    Commented Nov 22, 2016 at 18:01
7
\$\begingroup\$

05AB1E, 102 90 89 69 bytes (EOIXC)

•Cv¶ÉH&9;´ß{ø‰¿šq3d$µ_©Û¶«K>Ò±sÒ9ÍÊC4ÊÚúNÏŒº9¨gÚSÞ•34B2ð:2ôvy`×}J3äû»

Try it online!

Output (230 bytes):

EEEEE      OOOO     IIIII     X   X      CCCC
E         O    O      I        X X      C    
EEEE      O    O      I         X       C    
E         O    O      I        X X      C    
EEEEE      OOOO     IIIII     X   X      CCCC

69 / 230 = 70% Compression

Explanation:

The theory was to pick vertically symmetrical letters, then encode the first 3 lines an palindromize them. Basically, I encoded as {#} of {Letter} in 2 byte pairs. I'm sure there's a better way to do this.

•Cv¶ÉH&9;´ß{ø‰¿šq3d$µ_©Û¶«K>Ò±sÒ9ÍÊC4ÊÚîòvÅr葾)jM•34B
                    <decodes to>
"E5 6O4 5I5 5X1 3X1 6C4E1 9O1 4O1 6I1 8X1 1X1 6C1 4E4 6O1 4O1 6I1 9X1 7C1 4"

2ô            # Split into encoded pairs.
  vy   }      # Loop through each letter and number pair.
    `×        # Add the letter X number of times.
       J      # Join together.
        3ä    # Split into 3 parts length.
          û   # Palindromize.
           »  # Print separated by newlines.

-20 bytes thanks to Emigna, I'll be in the chat to ask some questions soon ;).

\$\endgroup\$
5
  • 1
    \$\begingroup\$ You can save 19 bytes by replacing the string with •Cv¶ÉH&9;´ß{ø‰¿šq3d$µ_©Û¶«K>Ò±sÒ9ÍÊC4ÊÚîòvÅr葾)jM•34B2ð:. Hop in the 05AB1E chat if you have questions about encoding. \$\endgroup\$
    – Emigna
    Commented Nov 15, 2016 at 19:48
  • 1
    \$\begingroup\$ Also, 45ô can be . \$\endgroup\$
    – Emigna
    Commented Nov 15, 2016 at 19:52
  • \$\begingroup\$ @Emigna A is not vertically symmetrical, and neither is F. Going to guess that once you start using G or higher it'll ruin what you're talking about right? Also, with my compression methodology I wanted to avoid letters that had more than 1 occurrence per row. If you want to golf that solution and beat me I'd welcome the example :). \$\endgroup\$ Commented Nov 15, 2016 at 19:54
  • \$\begingroup\$ There's a 0 in the O (center row, right side) \$\endgroup\$ Commented Nov 15, 2016 at 20:09
  • 1
    \$\begingroup\$ •Cv¶ÉH&9;´ß{ø‰¿šq3d$µ_©Û¶«K>Ò±sÒ9ÍÊC4ÊÚúNÏŒº9¨gÚSÞ• fixes the O at the same byte count. \$\endgroup\$
    – Emigna
    Commented Nov 15, 2016 at 20:53
6
\$\begingroup\$

Vim, 116 bytes 99 bytes

ELITC

Golfed it under 100 with the help of @DrMcMoylex.

9i59Yo191919171
E L I T CPqqjx:%s/\d/\=repeat('"',submatch(0))
q8@q3bi  Y7w.PP4rE{wl4r 22wl.2x

This contains unprintable characters, so I've added them in below (Vim style), so you can see them.

9i5^[9^AYo191919171
E L I T C^[Pqqjx:%s/\d/\=repeat('^R"',submatch(0))
q8@q3bi  ^[Y7w.PP4rE{wl4r 22wl.2x

TryItOnline!

It basically uses the same run-length decode that the jelly answer does. I used letters where I could (hopefully) repeat the top on the bottom, and the middles would all 3 be the same. Once the tops, bottoms, and middles are created I edit the characters to make them correct:

  1. Add two spaces to the I (more on that below)
  2. Add two spaces to the T
  3. Add the bar of the E
  4. Remove the top of the L
  5. Remove the bottom of the T (and delete the 2 spaces)

I have to add two spaces to the I, because I didn't allow two digit numbers (so I wouldn't need a separator. This leads to a 9 space run where I need 11.

\$\endgroup\$
3
  • \$\begingroup\$ Welcome to PPCG, nice answer :). \$\endgroup\$ Commented Nov 16, 2016 at 17:30
  • \$\begingroup\$ I was almost begging for a Vim answer. \$\endgroup\$ Commented Nov 17, 2016 at 18:53
  • 2
    \$\begingroup\$ I always upvote vim. :) Some improvements I see. 1) you don't need the trailing slash on your substitute command. 2) Some useful synonyms: Y instead of Vy, FI instead of ?I<cr>, { instead of gg, w instead of fl. 3) If you use r instead of R, you can remove the <esc>. \$\endgroup\$
    – DJMcMayhem
    Commented Nov 17, 2016 at 22:35
6
\$\begingroup\$

MATL, 49 bytes

5:lyI&(g84*t0*ytP+g73*yy!qy5XyPl5LY(90*yy!P12-&hc

Try it online!

This produces the letters TIHZN:

TTTTT     IIIII     H   H     ZZZZZ     N   N
  T         I       H   H        Z      NN  N
  T         I       HHHHH       Z       N N N
  T         I       H   H      Z        N  NN
  T       IIIII     H   H     ZZZZZ     N   N

Explanation

T is relatively easy to build from scratch. I can be obtained essentially as T plus its vertical reflection. H is I transposed. N is Z transposed and vertically reflected.

5:        % Push [1 2 3 4 5]
lyI&(     % Write [1 ;2; 3; 4 ;5] in the third column, filling with zeros.
          % This gives the shape of the 'T'
g84*      % Change nonzeros into 84 (ASCII for 'T'). Zeros will be displayed
          % as spaces
t0*       % Duplicate and multiply by zeros. This gives the separator
y         % Duplicate from below: pushes the 'T' again
tP+       % Duplicate, flip vertically, add. Gives the shape of the 'I'
g73*      % Change nonzeros into 73 (ASCII for 'I')
yy        % Duplicate separator and 'I' array
!         % Transpose. Gives the shape of the 'H'
q         % Subtract 1. Transformss 73 into 72 (ASCII for 'H'), and 0 into -1,
          % which will later be changed back into 0 when converting to char
y         % Duplicate separator
5XyP      % Size-5 identity matrix flipped vertically: gives slash of the 'Z'
l5LY(     % Fill first and last rows with ones. Gives the shape of the 'Z'
90*       % Multiply by 90 (ASCII for 'Z')
yy        % Duplicate separator and 'Z' array
!P        % Transpose and flip vertically. Gives shape of the 'N'
12-       % Subtract 12 to yield ASCII code for 'N'. 0 is converted to -12
&h        % Concatenate the nine arrays horizontally
c         % Convert to char. Implicitly display
\$\endgroup\$
5
\$\begingroup\$

JavaScript ES6, 168 bytes, CHAMP

We can stop looking guys, we have a CHAMP over here

f=_=>
` C3cHaHdA2dMaMcP3
CgHaHcAaAcMM MMcPaP
CgH4cA4cM M McP3
CgHaHcAaAcMaMcP
 C3cHaHcAaAcMaMcP`.replace(/[a-z\d]/g,(a,i,c)=>+a?c[i-1].repeat(a):' '.repeat(parseInt(a,36)-7))

a.innerHTML = f()
<pre id=a>

\$\endgroup\$
5
\$\begingroup\$

Brainf*** 512 411 Bytes

Better redo:

This one does a better job at optimizing the tape, sacrificing setup characters for printing characters. The tape in this one looks like 'C' 'E' ' ' 'F' 'I' 'L' '\n', improving efficiency. I chose these because they lack internal spaces, making it so that they don't have to go back and forth between character and space more than necessary

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

If you want to read what it's doing:

Set the tape with 67,69,32,70,73,76,10
++++++++[>+++++++++>+++++++++>++++>+++++++++>+++++++++>+++++++++>+<<<<<<<-]>----->--->>-->+>++++>++<<<< 
.<<....>>.....<.....>.....>.....<.....>>.....<<.....>>>.>.<<<<<< First Line
.>>.........<.>.........>.<...........>>.<<.......>>>.>.<<<<<< Second Line
.>>.........<....>......>....<........>>.<<.......>>>.>.<<<<<< Third Line
.>>.........<.>.........>.<...........>>.<<.......>>>.>.<<<< Fourth Line
.<<....>>.....<.....>.....>.<.........>>.....<<.....>>>..... Fifth Line

Output:

 CCCC     EEEEE     FFFFF     IIIII     L
C         E         F           I       L
C         EEEE      FFFF        I       L
C         E         F           I       L
 CCCC     EEEEE     F         IIIII     LLLLL

Former Submission:

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

I chose to go with ABCDE because it make setting up the tape for output much easier, but the time and characters I wasted in going from the letter to ' ' for all the negative space inside the A, B, and D and the placement of the endline at the end of the tape kinda killed me, I think.

I ended up with a tape that had the values 0 0 'A' 'B' 'C' 'D' 'E' ' ' \n and then output from there

++++++++[>++++<-]>[>++>++>++>++>++>+<<<<<<-]>+>++>+++>++++>+++++>>++++++++++     This all sets up the tape as 0 0 A B C D E ' ' '\n'
<.<<<<<...>>>>>......<<<<....>>>>.......<<<....>>>.....<<....>>......<.....>>.<<<<<< First Line
.>>>>>...<<<<<.>>>>>.....<<<<.>>>>...<<<<.>>>>.....<<<.>>>.........<<.>>...<<.>>.....<.>>.<<<<<< Second Line
.....>>>>>.....<<<<....>>>>......<<<.>>>.........<<.>>...<<.>>.....<....>>.<<<<<< Third Line
.>>>>>...<<<<<.>>>>>.....<<<<.>>>>...<<<<.>>>>.....<<<.>>>.........<<.>>...<<.>>.....<.>>.<<<<<< Fourth Line
.>>>>>...<<<<<.>>>>>.....<<<<....>>>>.......<<<....>>>.....<<....>>......<..... Last Line

Output:

 AAA      BBBB       CCCC     DDDD      EEEEE
A   A     B   B     C         D   D     E
AAAAA     BBBB      C         D   D     EEEE
A   A     B   B     C         D   D     E
A   A     BBBB       CCCC     DDDD      EEEEE
\$\endgroup\$
1
  • \$\begingroup\$ You can use [<]> on 3 occasions to save 6 bytes. \$\endgroup\$
    – Jo King
    Commented Jan 20, 2018 at 11:51
4
\$\begingroup\$

V, 62, 53 bytes

iC±  I· D³ Dµ O³ O¸ Z3ñYp$XñS ´Cµ µIµ ´D· ³O¶ µZYHP

Try it online!

This outputs C I D O Z:

 CCCC     IIIII     DDDD       OOO      ZZZZZ
C           I       D   D     O   O        Z
C           I       D   D     O   O       Z
C           I       D   D     O   O      Z
 CCCC     IIIII     DDDD       OOO      ZZZZZ
\$\endgroup\$
0
4
\$\begingroup\$

Stax, 33 bytes "BCDEO"

┌☼&.àτ▲█╟;c♦▌ΩÅ╡≤♫¿(┌▲▲≡3*╤J s*è«

Run and debug it

I picked letters that

  • have vertical symmetry
  • whose middle three columns are identical

These properties mean that each letter can be represented by a 3x3 grid. Here are the 9 regions, represented by digits.

12223
45556
78889
45556
12223

Consider the letter "B". It can be represented by 3 octal digits: 656. Each digit contains three bits, which control which regions are enabled for that letter. This technique also works for "CDEO".

Unpacked, ungolfed, and commented, the program looks like this.

"!^*14>G2eo"!   crammed integer literal             [63672, 54545, 64565]
|p              palindromize                        [63672, 54545, 64565, 54545, 63672]
m               for each, run this and output...    
  E             extract decimal digits to array     [6, 3, 6, 7, 2]
  `)"+0`        compressed string literal           "BCDEO"
  \             zip arrays                          [[6, 66], [3, 67], [6, 68], [7, 69], [2, 79]]
  {             map array using block               
    E           explode array                       6, 66
    Z\          tuck a zero under, and make pair    6, [0, 66]
    :B          custom base convert                 [66, 66, 0] 
    3)          pad to length 3                     [66, 66, 0]
    3O\         tuck a one under a 3 and pair       [66, 66, 0], [1, 3]
    :B          repeat elements corresponding times [66, 66, 66, 66, 0]
    A(          pad right to length 10              [66, 66, 66, 66, 0, 0, 0, 0, 0, 0]
  m

Run this one

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

brainfuck, 380 371 351 bytes

Edit: -9 bytes by switching to multiples of 17 and combining printing the first line with correcting the offsets Edit: -20 by just using one cell to store the letters, you moron past me

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

Try it online!

The best thing about this code is that it vaguely represents the actual letter themselves when the appropriate whitespace is added.

How It Works

Sets up the tape in the format:
1 2 4 8 16 32 64 128 0 0'

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

....<. ..... .>+.... <..... >++..... <..... .>++...<. ..... >-..... ----<<------.>>
.<...>.<.....>+.<.... ..... >++.<.... ..... >++.<.... ..... >-.     ----<<.>>
..... <..... >+.<.... ..... >++....<. ..... >++.<..>..<.....>-....  ----<<.>>
.<...>.<.....>+.<.... ..... >++.<.... ..... >++.<...>.<..... >-.     ----<<.>>
....<. ..... .>+....< ..... >++.....< ..... .>++...<. ..... >-.
\$\endgroup\$
3
\$\begingroup\$

Python 2, 124 bytes

d,i,o,c,l,s,n='DIOCL \n'
T=d*4+s*6+i*5+s*6+o*3+s*7+c*4+s*5+l
M=d+s*3+d+s*7+i+s*7+o+s*3+o+s*5+c+s*9+l+n
print T+n,M,M,M,T+l*3

Similar to my other answer, but with better letter choices. Outputs this:

DDDD      IIIII      OOO       CCCC     L
D   D       I       O   O     C         L
D   D       I       O   O     C         L
D   D       I       O   O     C         L
DDDD      IIIII      OOO       CCCC     LLLL
\$\endgroup\$
3
\$\begingroup\$

Befunge, 120 bytes (CKYTF)

Source

#&49+14489+56*1449135*44711425*:12p9138*7+:89+:56*55*v_@
-1g05$$_\#!:2#-%#16#\0#/g#20#,g#+*8#4<80\9*2p06%5p05:<^:,g2!%5:

Output

  CCCC     K   K     Y   Y     TTTTT     FFFFF
 C         K  K       Y Y        T       F
 C         KKK         Y         T       FFFF
 C         K  K        Y         T       F
  CCCC     K   K       Y         T       F

Try it online!

In case it matters, I should point out that my output has a leading space on each line. The rules didn't explicitly prohibit that, so I'm hoping that's OK. If not, please just consider this a non-competing entry.

Explanation

The letters of the word are encoded as a simple sequence of 25 integers, each integer being a binary representation of 5 pixels. Since Befunge requires you to perform a calculation to instantiate any integer greater than 9, the letters were chosen so as to minimize the number of calculations required, and ordered so potential repeating values could be duplicated rather than recalculated.

We also need to store the ASCII value of each letter, offset by 32, in an array which is indexed by the modulo 5 of a decrementing index (so it goes 0 4 3 2 1 ...). The reason for offsetting by 32 is so the value can be multiplied by a pixel bit (1 or 0) and then added to 32 to produce either a space or the character required.

This array of letter values is stored in the first 5 bytes of the code, so it's easy to access. This also then influenced the choice of letters, since those values needed to be meaningful when interpreted as a code sequence. This is the sequence #&49+. The # jumps over the & and the 49+ just pushes 13 onto the stack which is subsequently ignored.

\$\endgroup\$
3
  • \$\begingroup\$ You're asking for integer input with the &, but your program doesn't actually take input...what's going on? \$\endgroup\$ Commented Nov 16, 2016 at 0:06
  • \$\begingroup\$ That character is skipped by '#' \$\endgroup\$
    – 12Me21
    Commented Feb 5, 2018 at 19:30
  • \$\begingroup\$ @12Me21 I explained the reasoning behind that in the last paragraph. \$\endgroup\$ Commented Feb 11, 2018 at 13:47
3
\$\begingroup\$

Ruby, 110 107 102 bytes (DOCIL)

puts a=?D*4+(t=' '*7)+?O*3+t+?C*4+(s=' '*5)+?I*5+s+?L,['D   D'+s+'O   O'+s+?C+' '*11+?I+t+?L]*3,a+?L*4

Prints

DDDD       OOO       CCCC     IIIII     L
D   D     O   O     C           I       L
D   D     O   O     C           I       L
D   D     O   O     C           I       L
DDDD       OOO       CCCC     IIIII     LLLLL

EDIT: Saved some chars by avoiding join and moving things around

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

Befunge-98, 109 98 bytes (FUNGE / ANY)

:5%!2>j#4_;\$&\#;\:0`!#@_:::'@/'@*-\'@/2%*' +,:'@/:2/-'@*-\1+:5%!2>j#4_;' 3k:4k,#;:55*%!2>j#4_;a,;

Try it online!

Input (115 characters):

2022 1141 1134 935 2021 102 1141 1262 103 101 998 1141 1390 1639 997 102 1141 1646 1127 101 102 949 1134 935 2021 0

Input is the integer version of a binary number with the format aaaaabbbbbb where aaaaa is a reversed map of the character to print (for example, the second row in the N is NN N, so the mask is 10011), and bbbbbb is the ascii character to print, minus 32.

I also created a befunge-98 program to create my inputs:

4k~44p34p24p14p04p          v
+1.+-**244g4%5\**88_@#`0:&::<

Try it online!

Output (255 characters):

FFFFF     U   U     N   N      GGG      EEEEE     
F         U   U     NN  N     G         E         
FFFF      U   U     N N N     G  GG     EEEE      
F         U   U     N  NN     G   G     E         
F          UUU      N   N      GGG      EEEEE     

(255 - (115 + 98)) / 255 = 16% compression

Explanation:

:5%!2>j#4_;\$&\#;\:0`!#@_     Get input if it is available, else end program
:::'@/'@*-\'@/2%*' +,         Output the current input character (or a space,
                              if the mask dictates so)
:'@/:2/-'@*-                  Throw away current mask bit
\1+                           Swap loop iterator to top of stack, increment it
:5%!2>j#4_;' *3k:4k,#;        If iterator % 5 == 0, print five spaces
:55*%!2>j#4_;a,;              If iterator % 25 == 0, print newline character

This is probably pretty golfable; I've spent barely any time thinking about potential reductions.

Theoretically this can print any sequence of 5x5 ascii art.

Thanks to James Holderness for helping me get out of triple digits!

\$\endgroup\$
1
  • \$\begingroup\$ To take the idea further, 48* can be replaced with ' (since this is 98 after all), and 88* can be replaced with '@. Thanks for helping me get out of triple digits! \$\endgroup\$ Commented Nov 16, 2016 at 19:32
3
\$\begingroup\$

C#, 290 279 267 265 Bytes

Edit: Saved 12 bytes thanks to @milk! And 2 more thanks to @TheLethalCoder

Golfed:

void F(){string g="     ",h="H   H",A="A   A",B=h+"|"+A;Func<string,string>j=a=>a.Replace("|",g)+"\n";Console.Write(j(" SSSS|"+h+"| AAA |RRRR |PPPP")+j("S    |"+B+"|R   R|P   P")+j(" SSS |HHHHH|AAAAA|RRRR |PPPP")+j("    S|"+B+"|R  R |P")+j("SSSS |"+B+"|R   R|P"));}

Ungolfed:

public void F()
{
  string g = "     ", h = "H   H", A = "A   A", B = h + "|" + A;
  Func<string, string> j = a => a.Replace("|", g) + "\n";
  Console.Write(j(" SSSS|" + h + "| AAA |RRRR |PPPP") +
  j("S    |" + B + "|R   R|P   P") +
  j(" SSS |HHHHH|AAAAA|RRRR |PPPP") +
  j("    S|" + B + "|R  R |P") +
  j("SSSS |" + B + "|R   R|P"));
}

Outputs:

 SSSS     H   H      AAA      RRRR      PPPP
S         H   H     A   A     R   R     P   P
 SSS      HHHHH     AAAAA     RRRR      PPPP
    S     H   H     A   A     R  R      P
SSSS      H   H     A   A     R   R     P
\$\endgroup\$
8
  • \$\begingroup\$ There was a second where I thought that your C code was 290279 bytes in length. \$\endgroup\$
    – Steven H.
    Commented Nov 16, 2016 at 0:17
  • 1
    \$\begingroup\$ @StevenH. It feels that way Golfing in C# :) \$\endgroup\$
    – Pete Arden
    Commented Nov 16, 2016 at 0:30
  • \$\begingroup\$ -12 bytes if you define the local function like this Func<string,string>j=a=>a.Replace("|",g)+"\r\n"; \$\endgroup\$
    – milk
    Commented Nov 16, 2016 at 6:46
  • \$\begingroup\$ @milk Cool, thanks! :) \$\endgroup\$
    – Pete Arden
    Commented Nov 16, 2016 at 11:07
  • \$\begingroup\$ Do you need the \r in the \r\n? Would save 2 bytes \$\endgroup\$ Commented Nov 17, 2016 at 17:00
3
\$\begingroup\$

Perl 5 -p, 82 bytes (DOCIL)

Using the same letters and strategy everyone else is using (reusing the lines where possible), combined with an RLE decoder.

}{$_=($;="4D7 3O7 4C5 5I5 L")."
D3 D5 O3 O5 C11 I7 L"x3 ."
$;4L";s/\d+(.)/$1x$&/ge

Try it online!


Perl 5 -p, 95 bytes (ABCDE)

Contains unprintables, so the link includes them in \x## notation. Verification for 95 bytes.

}{$_=unpack B125,"w...0.?.G..#....";s;.;($&?(A..E)["@-"/5%5]:$").("@+"%25?$"x5x!("@+"%5):$/);ge

Try it online!

Explanation

The main data is stored as a binary matrix in the 16 byte string passed to unpack, which is called to convert to binary. Then s/// is called to replace each character with either $" (space) or if $& is falsy (0) or (A..E)["@-"/5%5] otherwise, where "@-" is the start index of the current character (@- is a list so $-[0] would return the first element, but interpolating into a string is 1 byte shorter) and we divide it by 5 and then take that result modulo 5 resulting in 0-4 (as the decimal part is ignored in list indices) based on the position, this correctly gets the letters in the right place for each of the larger letters. This is then appended to with, if "@+"%25 (like "@-" above, but @+ contains the end index of the current match) is truthy, $"x5x!("@+"%5) (space repeated [x] five times, repeated once when "@+"%5 is false) which adds the required spaces after each letter, or $/ (newline) otherwise.

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

Python 3, 234 228 227 166 bytes (CLOUD):

import base64,gzip;b=b'ABzY86gn$d0{>HR1_A{T@KJyRe}8`nBNU1i6kLFS%Nec$q1YdaQ51tPO;sx(oDBkK&Q=Hwg(wC)8vxUXJX_-c000';print(gzip.decompress(base64.b85decode(b)).decode())

Prints:

 CCCC     L          OOO      U   U     DDDD
C         L         O   O     U   U     D   D
C         L         O   O     U   U     D   D
C         L         O   O     U   U     D   D
 CCCC     LLLLL      OOO       UUU      DDDD
\$\endgroup\$
2
\$\begingroup\$

Python 3, 178 bytes

e,f,i,t,h,s='EFITH '
p=print
S=s*5
D=i+s*9+t+s*7
A=e*5+S
F=S+i*5+S
B=e+s*9+f+s*11+D+h+s*3+h
C=h+s*3+h
p(A+f*5+F+t*5+S+C)
p(B)
p(e*4+s*6+f*4+s*8+D+h*5)
p(B)
p(A+f+s*4+F,s+t+s*7+C)

Won't win, but does not use any compression. It makes this:

EEEEE     FFFFF     IIIII     TTTTT     H   H
E         F           I         T       H   H
EEEE      FFFF        I         T       HHHHH
E         F           I         T       H   H
EEEEE     F         IIIII       T       H   H

Any help is welcome, I probably missed something. I didn't use Python 2 because you can't do the p=print, and that saves 17 bytes. Try it on repl.it.

\$\endgroup\$
4
  • 2
    \$\begingroup\$ What is up with that F? \$\endgroup\$ Commented Nov 15, 2016 at 22:03
  • \$\begingroup\$ @DestructibleWatermelon I don't know how I missed that, but it is fixed now. \$\endgroup\$
    – nedla2004
    Commented Nov 15, 2016 at 22:14
  • \$\begingroup\$ Golfed below original size: 160 bytes, Python 2 \$\endgroup\$ Commented Nov 17, 2016 at 1:07
  • \$\begingroup\$ Rather than using p=print, you can use a single print statement with the kw argument sep='\n'. \$\endgroup\$
    – Luca Citi
    Commented Mar 29, 2018 at 8:29
2
\$\begingroup\$

Ruby, 101 bytes (TIFLE)

"o@h@u".bytes{|i|k=3+i%2;puts "%-10s"*5%"TIFLE".chars.map{|j|i/=2;(i/16>i%2*3?'  ':'')+j+j*k*(i%2)}}

TTTTT     IIIII     FFFFF     L         EEEEE
  T         I       F         L         E
  T         I       FFFF      L         EEEE
  T         I       F         L         E
  T       IIIII     F         LLLLL     EEEEE

I picked letters that required a single block of letters (1,4 or 5 letters long) on each line. F,L and E are left justified, but T and I require leading spaces where a single letter (vertical part) is printed. The code for adding these spaces looks like it could be improved.

ungolfed

"o@h@u".bytes{|i|               #for each byte (64 always set, 32...2 bits set for horiz bar, 1 bit=length of bar)
   k=3+i%2                      #decode least sig. bit for no of chars printed if a 1 is found
   puts "%-10s"*5%              #puts "%-10s%-10s%-10s%-10s%-10s" format string (expects array of subsitutes)
     "TIFLE".chars.map{|j|      #for each letter 
        i/=2                    #halve i
        (i/16>i%2*3?'  ':'')+   #if i large enough and i%2 zero, add leading space (or T and I)
        j+j*k*(i%2)             #print the letter once, then additional letters if bar required.
     }
}
\$\endgroup\$
2
\$\begingroup\$

C 176 bytes

If implicit ints are allowed then it's possible to cut off another 8 bytes.

#define C ,//11 bytes
#define R(r)r r r r r//21 bytes
T(int l){int c=324;printf(R(R("%c")R(" "))"\n" R(R(C(++c,l>>=1)&1?c/5:32)));}//77 bytes
f(){T(67010460);T(34702434);T(66160574);T(34702434);T(67010466);}//65 bytes

Output: E D C B A

EEEEE     DDDD       CCCC     BBBB       AAA      
E         D   D     C         B   B     A   A     
EEEEE     D   D     C         BBBB      AAAAA     
E         D   D     C         B   B     A   A     
EEEEE     DDDD       CCCC     BBBB      A   A     

How it works: The macro R just repeats a piece of code 5 times. Given how often fives appear in this problem, very useful. Now: here's what T(int) does. T takes an integer, and uses it as a bit field to determine where to print letters and where to print white space. For example, if given T(0b11111111100111111110011100), it will output: EEEEE DDDD CCCC BBBB AAA . It progressively counts down as to what letter it prints. First it prints E, then D, then C, then B, then A. Calling f() will print the entire thing.

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

Batch, 135 bytes (DOCILe)

@set b=     
@set s=@echo DDDD%b%  OOO%b%  CCC%b% IIIII%b%L
@set t=@echo D   D%b%O   O%b%C%b%%b% I%b%  L
%s%
%t%
%t%
%t%
%s%LLLL

Note: the first line ends in 5 spaces.

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

BASH, 95, 111 bytes (EBASH)

Golfed

base64 -d<<<4ADlADhdACLpBDSMnNdRTj0Ob2qBPVT3HkdMRZzZ3kL+yIb6mhkz06EM+KOspSDy2EBoUKKL6pfwNo0akV0zAA==|xz -dqFraw

Explanation

Base64 over raw LZMA byte stream

Demo

>base64 -d<<<4ADlADhdACLpBDSMnNdRTj0Ob2qBPVT3HkdMRZzZ3kL+yIb6mhkz06EM+KOspSDy2EBoUKKL6pfwNo0akV0zAA==|xz -dqFraw

EEEEE     BBBB       AAA       SSSS     H   H
E         B   B     A   A     S         H   H
EEEE      BBBB      AAAAA      SSS      HHHHH
E         B   B     A   A         S     H   H
EEEEE     BBBB      A   A     SSSS      H   H

Disclaimer

Yes, I'm well aware that this is not really portable, that's why I've paid a byte to suppress the xz warnings with -q in the first case >:)

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

Python 2, 208 194 193 bytes

This is my first ever code golf ;) Fun to do

for i in range(0,25,5):
 for c,p in {'M':18732593,'O':15255086,'N':18667121,'T':32641156,'Y':18157700}.items():
  print format(p,'025b')[i:i+5].replace('0',' ',).replace('1',c)+'   ',
 print

Output:

Y   Y    M   M    TTTTT     OOO     N   N
 Y Y     MM MM      T      O   O    NN  N
  Y      M M M      T      O   O    N N N
  Y      M   M      T      O   O    N  NN
  Y      M   M      T       OOO     N   N

Using a dictionary destroys the sort order of the letters, but that was not a requirement

\$\endgroup\$
1
  • \$\begingroup\$ It could do -4 if we take letters that do not use the upper left corner. This would result in a 24 bit (instead of a 25 bit) number which takes up one less digit in hex. \$\endgroup\$
    – Pleiadian
    Commented Nov 17, 2016 at 15:22

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.