C 550 503
#define L putchar('\n');
c,b,i,j,m[]={0xe9d72e,0x10fd25,0x9ace29,0x556b5,0x4fd184,0x16ad6bd,0x156ae,0xc5e10,0x556aa,0x756a8,0,0,0,0,0,0,0,0xfa51e0,0xaad7e0,0x118c5c0,0xe8c7e0,0x15ad7e0,0x14a53e0,0x16ac5c0,0x1f213e0,0xf8000,0x1e08440,0x11513e0,0x1087e0,0x1f4111f,0x1f223e0,0xe8c62e,0x8a53e0,0xd9462e,0x5d29f,0x12ad6a9,0x1087e10,0xf043e,0x18304d8,0x1c1f07c,0xd909b,0xf14bd,0xcd6b3};main(){for(;;){c=getchar();c=c<48?11:c>90?c-80:c-48;b=0;for(i=0;i<5;i++){for(j=0;j<5;j++)putchar(m[c]&(1<<b++)?35:32);L}L}}
(Incorporated BrainSteel's tips and optimized a bit more)
Here's the non-obfuscated code:
#include <stdio.h>
int map[]
={
// 0 - 9
0xe9d72e, 0x10fd25, 0x9ace29, 0x556b5, 0x4fd184, 0x16ad6bd, 0x156ae, 0xc5e10, 0x556aa, 0x756a8,
// Other stuff
0,0,0,0,0,0,0,
// A - Z
0xfa51e0, 0xaad7e0, 0x118c5c0, 0xe8c7e0, 0x15ad7e0, 0x14a53e0, 0x16ac5c0, 0x1f213e0, 0xf8000, 0x1e08440, 0x11513e0, 0x1087e0, 0x1f4111f, 0x1f223e0, 0xe8c62e, 0x8a53e0, 0xd9462e, 0x5d29f, 0x12ad6a9, 0x1087e10, 0xf043e, 0x18304d8, 0x1c1f07c, 0xd909b, 0xf14bd, 0xcd6b3
};
int main()
{
for(;;)
{
int c = getchar();
c = c < '0' ? 11 : c > 'Z' ? c - ('0' + 'a' - 'A') : c - '0';
int bit = 0;
for(int i=0; i<5; i++)
{
for(int j=0; j<5; j++)
putchar(map[c] & (1 << bit++) ? '#' : ' ');
putchar('\n');
}
putchar('\n');
}
}
I've encoded the characters the following way: I wrote a C "script" that takes a 5x5 area of characters from STDIN, changes "space" to 0 and anything else to 1, rotates the whole area by 90 degrees and finally puts every cell of the area in one bit of a 32-bit integer (the hex numbers in 'map').
That's how the "script" looks like:
#include <stdio.h>
int main()
{
int array[5][5];
for(int i=0; i<5; i++)
{
for(int j=0; j<5; j++)
array[j][i] = (getchar() != ' ');
getchar();
}
int res = 0;
int bit = 0;
for(int j=0; j<5; j++)
{
for(int i=0; i<5; i++)
res = res | (array[j][4-i] << bit++);
}
printf("0x%x\n", res);
return 0;
}
I am pretty sure there are FAR smaller programs possible (for example in Perl or Ruby), but this is the best I can come up with right know.
Why the down vote? I think this is an ok question, just a bit broad. – Matt Young – 2015-06-15T10:37:18.953
2I think the key problem here is "legible", which leans on the subjective side. It'd be better to provide an alphabet so we know what each letter should look like, but even then it'd only be a straight-out compression challenge. – Sp3000 – 2015-06-15T10:46:06.110
2That makes sense. I went and found a font to eliminate the vagueness. – Kody King – 2015-06-15T11:03:48.703
1The font does not have lowercase letters. You should either link to a font that does, or modify your sample output for
"Hi"
. – Cristian Lupascu – 2015-06-15T11:37:20.4802Based on earlier experience, future questions may be: are functions accepted or needs to be a standalone program; can command line parameters be used instead of stdin; can the result returned instead of sent to stdout; number of empty lines between characters/words; is padding accepted/required; are other characters beside “#”, space and newline allowed. Is really irritating after you struggle to golf a solution strictly matching the specification to see someone else forcing the rules and the question owner just nodding that is acceptable too. – manatwork – 2015-06-15T13:55:05.380
4This contest would be a lot more enjoyable if the question already contained the 36 characters we have to support. It would also eliminate a few ambiguities, like, e.g., the required width of and padding between two characters. – Dennis – 2015-06-15T14:35:05.300
1Welcome to PPCG. Further to @Dennis's comment: 1. the H in your example does not comply with the linked font; 2. while I see nothing wrong with a variable width font, the fact that the spacing between letters is variable in the linked graphic is confusing and ambiguous. Can we assume that the spacing must always be exactly 1 blank cell after the printed area of the character? – Level River St – 2015-06-15T14:53:37.207
Is input guaranteed to be ASCII or is
å
an acceptable input we need to account for? – Not that Charles – 2015-06-16T16:42:37.243Only worry about A-Z and 0-9. – Kody King – 2015-06-16T17:19:32.983