-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#NNNGM: Another 50,000 Meows! #105
Comments
The rules of #NNNGM say nothing of counting including the interpreter, the Basic version12 characters
Better version78 charactersimport 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 ***@***.***> 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
<#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 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:
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:
|
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
p -c 'print("meow "*9**5)'
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.
p -c 'import random as r;print(" meow".join([r.choice(",:;.?!") for _ in range(9**5)])[2:])'
Preview
Much better!
Full output
The text was updated successfully, but these errors were encountered: