C, 212 bytes
d;main(){char*t="##3#b#b3#bbb3#b#b##\r#3b1#+3@12b3@1b-3@1_b3b1#,#\r7#_##+51rR04/1b#61rR0,8#2##\r7?#2#+9#`A#9=###9#^?#,8A#_#\r#+:#%b#:=#b#:#%b#,#",p[9];for(gets(p);d=*t++;putchar(d-3))d=d<51?d:(p[d-51]-53)[t+=4];}
A readable version:
d;
main()
{
char *t = "##3#b#b3#bbb3#b#b##\r"
"#3b1#+3@12b3@1b-3@1_b3b1#,#\r"
"7#_##+51rR04/1b#61rR0,8#2##\r"
"7?#2#+9#`A#9=###9#^?#,8A#_#\r"
"#+:#%b#:=#b#:#%b#,#",
p[9]; // 9 bytes is just enough for the input string of length 8
for (gets(p); d = *t++; putchar(d-3))
d = d < 51 ? d : (p[d - 51] - 53)[t += 4];
}
I took the idea from the answer by Reto Koradi the answer by Reto Koradi. There were several fun improvements I did, which may warrant posting a separate answer:
- Converted from function to program (+10)
- Moved newlines into the control string (-7)
- Added 3 to all character codes to have fewer escaped chars like
\"(-3) - Reading from the string with autoincrement; also replaced
t[i++]by*t++(-4) - Replaced
whilebyfor; removed{}(-4) - Simplified loop termination: reading until
0円(-9) - Transformed
t[...],t+=4to(...)[t+=4]to eliminate the comma operator (-1)
Why all that trouble? To share my favorite one, snow ghost:
_
/_\
\(. .)/
( )
(___)
C, 212 bytes
d;main(){char*t="##3#b#b3#bbb3#b#b##\r#3b1#+3@12b3@1b-3@1_b3b1#,#\r7#_##+51rR04/1b#61rR0,8#2##\r7?#2#+9#`A#9=###9#^?#,8A#_#\r#+:#%b#:=#b#:#%b#,#",p[9];for(gets(p);d=*t++;putchar(d-3))d=d<51?d:(p[d-51]-53)[t+=4];}
A readable version:
d;
main()
{
char *t = "##3#b#b3#bbb3#b#b##\r"
"#3b1#+3@12b3@1b-3@1_b3b1#,#\r"
"7#_##+51rR04/1b#61rR0,8#2##\r"
"7?#2#+9#`A#9=###9#^?#,8A#_#\r"
"#+:#%b#:=#b#:#%b#,#",
p[9]; // 9 bytes is just enough for the input string of length 8
for (gets(p); d = *t++; putchar(d-3))
d = d < 51 ? d : (p[d - 51] - 53)[t += 4];
}
I took the idea from the answer by Reto Koradi. There were several fun improvements I did, which may warrant posting a separate answer:
- Converted from function to program (+10)
- Moved newlines into the control string (-7)
- Added 3 to all character codes to have fewer escaped chars like
\"(-3) - Reading from the string with autoincrement; also replaced
t[i++]by*t++(-4) - Replaced
whilebyfor; removed{}(-4) - Simplified loop termination: reading until
0円(-9) - Transformed
t[...],t+=4to(...)[t+=4]to eliminate the comma operator (-1)
Why all that trouble? To share my favorite one, snow ghost:
_
/_\
\(. .)/
( )
(___)
C, 212 bytes
d;main(){char*t="##3#b#b3#bbb3#b#b##\r#3b1#+3@12b3@1b-3@1_b3b1#,#\r7#_##+51rR04/1b#61rR0,8#2##\r7?#2#+9#`A#9=###9#^?#,8A#_#\r#+:#%b#:=#b#:#%b#,#",p[9];for(gets(p);d=*t++;putchar(d-3))d=d<51?d:(p[d-51]-53)[t+=4];}
A readable version:
d;
main()
{
char *t = "##3#b#b3#bbb3#b#b##\r"
"#3b1#+3@12b3@1b-3@1_b3b1#,#\r"
"7#_##+51rR04/1b#61rR0,8#2##\r"
"7?#2#+9#`A#9=###9#^?#,8A#_#\r"
"#+:#%b#:=#b#:#%b#,#",
p[9]; // 9 bytes is just enough for the input string of length 8
for (gets(p); d = *t++; putchar(d-3))
d = d < 51 ? d : (p[d - 51] - 53)[t += 4];
}
I took the idea from the answer by Reto Koradi. There were several fun improvements I did, which may warrant posting a separate answer:
- Converted from function to program (+10)
- Moved newlines into the control string (-7)
- Added 3 to all character codes to have fewer escaped chars like
\"(-3) - Reading from the string with autoincrement; also replaced
t[i++]by*t++(-4) - Replaced
whilebyfor; removed{}(-4) - Simplified loop termination: reading until
0円(-9) - Transformed
t[...],t+=4to(...)[t+=4]to eliminate the comma operator (-1)
Why all that trouble? To share my favorite one, snow ghost:
_
/_\
\(. .)/
( )
(___)
C, 212 bytes
d;main(){char*t="##3#b#b3#bbb3#b#b##\r#3b1#+3@12b3@1b-3@1_b3b1#,#\r7#_##+51rR04/1b#61rR0,8#2##\r7?#2#+9#`A#9=###9#^?#,8A#_#\r#+:#%b#:=#b#:#%b#,#",p[9];for(gets(p);d=*t++;putchar(d-3))d=d<51?d:(p[d-51]-53)[t+=4];}
A readable version:
d;
main()
{
char *t = "##3#b#b3#bbb3#b#b##\r"
"#3b1#+3@12b3@1b-3@1_b3b1#,#\r"
"7#_##+51rR04/1b#61rR0,8#2##\r"
"7?#2#+9#`A#9=###9#^?#,8A#_#\r"
"#+:#%b#:=#b#:#%b#,#",
p[9]; // 9 bytes is just enough for the input string of length 8
for (gets(p); d = *t++; putchar(d-3))
d = d < 51 ? d : (p[d - 51] - 53)[t += 4];
}
I took the idea from the answer by Reto Koradi. There were several fun improvements I did, which may warrant posting a separate answer:
- Converted from function to program (+10)
- Moved newlines into the control string (-7)
- Added 3 to all character codes to have fewer escaped chars like
\"(-3) - Reading from the string with autoincrement; also replaced
t[i++]by*t++(-4) - Replaced
whilebyfor; removed{}(-4) - Simplified loop termination: reading until
0円(-9) - Transformed
t[...],t+=4to(...)[t+=4]to eliminate the comma operator (-1)
Why all that trouble? To share my favorite one, snow ghost:
_
/_\
\(. .)/
( )
(___)
C, 212 bytes
d;main(){char*t="##3#b#b3#bbb3#b#b##\r#3b1#+3@12b3@1b-3@1_b3b1#,#\r7#_##+51rR04/1b#61rR0,8#2##\r7?#2#+9#`A#9=###9#^?#,8A#_#\r#+:#%b#:=#b#:#%b#,#",p[9];for(gets(p);d=*t++;putchar(d-3))d=d<51?d:(p[d-51]-53)[t+=4];}
I took the idea from the answer by Reto Koradi. There were several fun improvements I did, which may warrant posting a separate answer:
- Converted from function to program (+10)
- Moved newlines into the control string (-7)
- Added 3 to all character codes to have fewer escaped chars like
\"(-3) - Reading from the string with autoincrement; also replaced
t[i++]by*t++(-4) - Replaced
whilebyfor; removed{}(-4) - Simplified loop termination: reading until
0円(-9) - Transformed
t[...],t+=4to(...)[t+=4]to eliminate the comma operator (-1)
Why all that trouble? To share my favorite one, snow ghost:
_
/_\
\(. .)/
( )
(___)
C, 212 bytes
d;main(){char*t="##3#b#b3#bbb3#b#b##\r#3b1#+3@12b3@1b-3@1_b3b1#,#\r7#_##+51rR04/1b#61rR0,8#2##\r7?#2#+9#`A#9=###9#^?#,8A#_#\r#+:#%b#:=#b#:#%b#,#",p[9];for(gets(p);d=*t++;putchar(d-3))d=d<51?d:(p[d-51]-53)[t+=4];}
A readable version:
d;
main()
{
char *t = "##3#b#b3#bbb3#b#b##\r"
"#3b1#+3@12b3@1b-3@1_b3b1#,#\r"
"7#_##+51rR04/1b#61rR0,8#2##\r"
"7?#2#+9#`A#9=###9#^?#,8A#_#\r"
"#+:#%b#:=#b#:#%b#,#",
p[9]; // 9 bytes is just enough for the input string of length 8
for (gets(p); d = *t++; putchar(d-3))
d = d < 51 ? d : (p[d - 51] - 53)[t += 4];
}
I took the idea from the answer by Reto Koradi. There were several fun improvements I did, which may warrant posting a separate answer:
- Converted from function to program (+10)
- Moved newlines into the control string (-7)
- Added 3 to all character codes to have fewer escaped chars like
\"(-3) - Reading from the string with autoincrement; also replaced
t[i++]by*t++(-4) - Replaced
whilebyfor; removed{}(-4) - Simplified loop termination: reading until
0円(-9) - Transformed
t[...],t+=4to(...)[t+=4]to eliminate the comma operator (-1)
Why all that trouble? To share my favorite one, snow ghost:
_
/_\
\(. .)/
( )
(___)
C, 212 bytes
d;main(){char*t="##3#b#b3#bbb3#b#b##\r#3b1#+3@12b3@1b-3@1_b3b1#,#\r7#_##+51rR04/1b#61rR0,8#2##\r7?#2#+9#`A#9=###9#^?#,8A#_#\r#+:#%b#:=#b#:#%b#,#",p[9];for(gets(p);d=*t++;putchar(d-3))d=d<51?d:(p[d-51]-53)[t+=4];}
I took the idea from the answer by Reto Koradi. There were several fun improvements I did, which may warrant posting a separate answer:
- Converted from function to program (+10)
- Moved newlines into the control string (-7)
- Added 3 to all character codes to have fewer escaped chars like
\"(-3) - Reading from the string with autoincrement; also replaced
t[i++]by*t++(-4) - Replaced
whilebyfor; removed{}(-4) - Simplified loop termination: reading until
0円(-9) - Transformed
t[...],t+=4to(...)[t+=4]to eliminate the comma operator (-1)
Why all that trouble? To share my favorite one, snow ghost:
_
/_\
\(. .)/
( )
(___)