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.
"Hi"
. \$\endgroup\$ – Cristian Lupascu Jun 15 '15 at 11:37