Open hugovk opened 4 years ago
The rules of #NNNGM say nothing of counting including the interpreter, the p -c
bit. So, assuming you're already at a Python IDLE prompt, the source code is much shorter.
"meow "*9**5
import random as r;" meow".join([r.choice(",:;.?!") for _ in range(9**5)])[2:]
43 characters of shell:
for i in {1..25000};do echo meow{?,.};done
Requires a ksh-compatible shell. I'm sure it can be done shorter with some cleverness.
On Thu, Nov 21, 2019 at 5:36 PM Hugo van Kemenade notifications@github.com wrote:
The rules of #NNNGM say nothing of counting including the interpreter, the p -c bit. So, assuming you're already at a Python IDLE prompt, the source code is much shorter. Basic version 12 characters
"meow "*9**5
Better version 78 characters
import random as r;" meow".join([r.choice(",:;.?!") for _ in range(9**5)])[2:]
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/NaNoGenMo/2019/issues/105?email_source=notifications&email_token=AADXUGKLR5Y3MCXLA3PJNBLQU4ENXA5CNFSM4JQI4KRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEE34P7Y#issuecomment-557303807, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADXUGMP4JN53S7MNAN5JWDQU4ENXANCNFSM4JQI4KRA .
The punctuation really improved my reading experience. Bravo on pioneering Nano-NaNoGenMo!
Hooray!
You don't need the space between -c
and '
by the way.
I think it's stylish to have your #NNNGM code runnable on the command line. But actually it doesn't have to be, according to me. When I first blogged about this, I just wrote:
write computer programs that are at most 256 characters, and which generate 50,000 word or more novels. These can use Project Gutenberg files, as they are named on that site, as input. Or, they can run without using any input.
You could have a 256-character .py file if you like.
In this case I do like the golfing of the program, but I like this final version the best even though it adds four unnecessary charcaters:
python -c'print("meow "*9**5)'|cat
Prologue
The source code for 50,000 Meows from 2014 is way too long:
We can do better than that!
Nano-NaNoGenMo
Especially for Nano-NaNoGenMo or #NNNGM:
(This quote is 253 characters.)
Basic version
26 characters
Preview
Is it cheating I have
p
aliased topython
? Maybe, but I'm going to say it's not as I already set up like that and it wasn't done just for NNNGM, and it wouldn't exceed the 256 limit anyway.Why
9**5
and not50000
?9**5
is one character shorter than50000
Full output
Better version
92 characters
The basic version is clearly nonsense, as there's no punctuation. This one makes much more sense.
Preview
Much better!
Full output