Code Golf - Banner Generation

Posted by Claudiu on Stack Overflow See other posts from Stack Overflow or by Claudiu
Published on 2010-06-06T19:12:45Z Indexed on 2010/06/06 19:22 UTC
Read the original article Hit count: 505

When thanking someone, you don't want to just send them an e-mail saying "Thanks!", you want to have something FLASHY:

Input: THANKS!!
Output:
TTT H H AAA N N K K SSS !!! !!! 
 T  H H A A NNN K K S   !!! !!! 
 T  HHH AAA NNN KK  SSS !!! !!! 
 T  H H A A N N K K   S            
 T  H H A A N N K K SSS !!! !!! 

Write a program to generate a banner. You only have to generate upper-case A-Z along with spaces and exclamation points (what is a banner without an exclamation point?). All characters are made up of a 3x5 grid of the same character (so the S is a 3x5 grid made of S). All output should be on one row (so no newlines). Here are all the letters you need:

Input: ABCDEFGHIJKL
Output:
AAA BBB CCC DD  EEE FFF GGG H H III JJJ K K L
A A B B C   D D E   F   G   H H  I    J K K L
AAA BBB C   D D EE  FF  G G HHH  I    J KK  L
A A B B C   D D E   F   G G H H  I  J J K K L
A A BBB CCC DD  EEE F   GGG H H III JJJ K K LLL

Input: MNOPQRSTUVWX
Output:
M M N N OOO PPP QQQ RR  SSS TTT U U V V W W X X
MMM NNN O O P P Q Q R R S    T  U U V V W W  X
M M NNN O O PPP Q Q RR  SSS  T  U U V V WWW  X
M M N N O O P   QQQ R R   S  T  U U V V WWW  X
M M N N OOO P   QQQ R R SSS  T  UUU  V  WWW X X

Input: YZ!
Output:
Y Y ZZZ !!!
Y Y   Z !!!
YYY  Z  !!!
  Y Z
YYY ZZZ !!!

The winner is the shortest source code. Source code should read input from stdin, output to stdout. You can assume input will only contain [A-Z! ]. If you insult the user on incorrect input, you get a 10 character discount =P.

I was going to require these exact 27 characters, but to make it more interesting, you can choose how you want them to look - whatever makes your code shorter! To prove that your letters do look like normal letters, show the output of the last three runs.

© Stack Overflow or respective owner

Related posts about language-agnostic

Related posts about code-golf

  • Code Golf: Collatz Conjecture

    as seen on Stack Overflow - Search for 'Stack Overflow'
    Inspired by http://xkcd.com/710/ here is a code golf for it. The Challenge Given a positive integer greater than 0, print out the hailstone sequence for that number. The Hailstone Sequence See Wikipedia for more detail.. If the number is even, divide it by two. If the number is odd, triple… >>> More

  • Code Golf - p day

    as seen on Stack Overflow - Search for 'Stack Overflow'
    The Challenge The shortest code by character count to display a representation of a circle of radius R using the *character, followed by an approximation of p. Input is a single number, R. Since most computers seem to have almost 2:1 ratio you should only output lines where y is odd. The approximation… >>> More

  • Code Golf - PI day

    as seen on Stack Overflow - Search for 'Stack Overflow'
    The Challenge The shortest code by character count to display a representation of a circle of radius R using the *character. Followed by an approximation of pi Input is a single number, R Since most computers seem to have almost 2:1 ratio you should only output lines where y is odd. The approximation… >>> More

  • Code Golf: Triforce

    as seen on Stack Overflow - Search for 'Stack Overflow'
    This is inspired by/taken from this thread: http://www.allegro.cc/forums/thread/603383 The Problem Assume the user gives you a numeric input ranging from 1 to 7. Input should be taken from the console, arguments are less desirable. When the input is 1, print the following: *********** *********… >>> More

  • Code Golf: Tic Tac Toe

    as seen on Stack Overflow - Search for 'Stack Overflow'
    Post your shortest code, by character count, to check if a player has won, and if so, which. Assume you have an integer array in a variable b (board), which holds the Tic Tac Toe board, and the moves of the players where: 0 = nothing set 1 = player 1 (X) 2 = player 2 (O) So, given the array b… >>> More