7 ms·
If you liked this then you might find my Python one liner games interesting [1]. They fit a tweet in most cases. [1]: http://arunrocks.com/python-one-liner-gam
by arocks 11y ago
If you liked this then you might find my Python one liner games interesting [1]. They fit a tweet in most cases.
[1]: http://arunrocks.com/python-one-liner-games/ http://arunrocks.com/python-one-liner-games/
- eigenbom 11y agoThese are pretty neat and very concise! :D
- simi_ 11y agoFor some reason copy-pasting some of those into iTerm2 doesn't work. http://i.imgur.com/GEMAeM8.png http://i.imgur.com/GEMAeM8.png
- vanous 11y agonot on a mac myself, but make sure to use python 3 python3 -c "import random;p=lambda:random.choice('7♪♫♣♠♦♥◄☼☽');[print('|'.join([p(),p(),p()]),end='\r') for i in range(8**5)]"
- throwathrowaway 11y agoI like that lambda trick. I was hoping Crash would actually crash the program so you could tell if you won by looking at the error it gives (if its KeyboardInterrupt or something else). Here's mine. $ python -c 'import random;L=sorted(str(random.randint(1,9)) for i in range(4));a=raw_input(L);print(eval(a)==24,sorted(filter(str.isdigit,a))==L)' ['2', '6', '7', '8']8*(7+2-6) (True, True) Try to make it print (True, True) without abusing eval too much (intended to be +-*/() only with digits as tokens). A nicer interface, but too long: import random;L=sorted(str(random.randint(1,9)) for i in range(4));a=raw_input(" ".join(L)+"\n> ");print(eval(a)==24,sorted(filter(str.isdigit,a))==L)