Python 3, 55 (bonus 67)
# 55 bytes, H(X)=3.72, Based on bitpwner's 66. "Mix dog and cat fur."
i=0;print("Mdacfionauxgdtr"[i::5],end=" ."[i>3]);i+=1;i
# 67 bytes, H(X)=4.28. "Thanks for supporting Python development."
q=b"qx!%%0077C";a,b,*q=q;print((str(credits)*2)[49:][a:b],end='');q
# 60 bytes, H(X) = 3.51. "Fix the bed old pal"
s="Fixthebedoldpal";a,b,c,*s=s;print(a+b+c,end='. '[s>[]]);s
You mean it wraps around?
OK, some explanation on #2 (spoilers)
credits
is a python builtin that contains text I'd like to use. It's of a special type with a formattedrepr
so that you can just type it in the interactive interpreter and see nice output, so I have tostr()
it. I spent quite a bit of time looking at builtins for this, and "Thanks for supporting Python development" as a phrase was too good to pass up.Since there's a lot of text and I only want my 5 words, I want to store the start and end positions of each substring. That's in the bytes at the beginning.
bytes
objects in python3 act like arrays of integers when you use sequence operations on them.But the code can contain only printable characters, so I had to find an offset (49) that would make all my position values printable as characters.
"Thanks" is near the beginning of the string while the other words are nearer the end, which means my position values were too far apart to all be in the printable range. Mulitplying the string by 2 makes another copy of "Thanks" that is nearer to the other words.
Taking the
[49:]
slice of the string is one fewer source byte than adding 49 to both a and b.The construct used in all three answers is
x=<value>;dostuff and increment;x
. The trailingx
doesn't do anything at all, but when combined with the next copy of the code it turns intoxx=<value>
which prevents thex
counter from being overwritten.a,b,*q=q
is perfectly normal Python 3 sequence unpacking.