Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
3 replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
source | link

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 Koradithe 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 while by for; removed {} (-4)
  • Simplified loop termination: reading until \0 (-9)
  • Transformed t[...],t+=4 to (...)[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 while by for; removed {} (-4)
  • Simplified loop termination: reading until \0 (-9)
  • Transformed t[...],t+=4 to (...)[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 while by for; removed {} (-4)
  • Simplified loop termination: reading until \0 (-9)
  • Transformed t[...],t+=4 to (...)[t+=4] to eliminate the comma operator (-1)

Why all that trouble? To share my favorite one, snow ghost:

   _
  /_\
\(. .)/
 (   )
 (___)
2 readability
source | link

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 while by for; removed {} (-4)
  • Simplified loop termination: reading until \0 (-9)
  • Transformed t[...],t+=4 to (...)[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 while by for; removed {} (-4)
  • Simplified loop termination: reading until \0 (-9)
  • Transformed t[...],t+=4 to (...)[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 while by for; removed {} (-4)
  • Simplified loop termination: reading until \0 (-9)
  • Transformed t[...],t+=4 to (...)[t+=4] to eliminate the comma operator (-1)

Why all that trouble? To share my favorite one, snow ghost:

   _
  /_\
\(. .)/
 (   )
 (___)
1
source | link

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 while by for; removed {} (-4)
  • Simplified loop termination: reading until \0 (-9)
  • Transformed t[...],t+=4 to (...)[t+=4] to eliminate the comma operator (-1)

Why all that trouble? To share my favorite one, snow ghost:

   _
  /_\
\(. .)/
 (   )
 (___)