I wondered - why not make some one-liner games in Python? And just to make it insanely hard, I would try to make it fit a tweet i.e. 140 characters. Let’s see what we could manage.
NOTE: All the one-liners below work only in Python 3. Depending on your platform, you might want to change the code by replacing
python -c "while 1:import random;print(random.choice('|| __'), end='')"
Create an infinite maze with this deceptively short one-liner. It is quite easy to understand too. The
while loop is infinite. The
import statement had to move inside the loop but Python takes care not to re-import it each time.
A random character is picked from one of the maze drawing characters and printed. An alternate version below has better maze drawing characters. But this version used characters which were displayable on the Windows shell (and possibly portable to other operating systems).
python -c "while 1:import random;print(random.choice('╱╲'), end='')"
This version ...