3 ms·
My favourite "world" generator one-liner (two liner in python): import random as r print(''.join([r.choice(["/", "\\"]) for _ in range(9999)])) Output:
by jackbrookes 8y ago
My favourite "world" generator one-liner (two liner in python):
import random as r
print(''.join([r.choice(["/", "\\"]) for _ in range(9999)]))
Output:
//\\/\//\\/\\\\/\\\/\//\\\\/\\/\\/\///\\\\///\\/\//\\\\/\\/\
/\\\\/////\\\\\/\\\\////\/\//////\////\\\//////\\\\\/\//\\\/
//\\\\\\/\/\\//\/\\\\///\\/\\//\\///\\/\/\\//\/\\/\///\\\\//
\\/\//\\\//////\/\/\/\\/\\//\/\///\\///\/\////\//\/\\\/\/\//
\\\\\\\\\/\//\\\//\\\/\\/\\\\\/\\\\\///\/\\/\\\\//\\/\\/\///
//\\/\//////////\\//\\\////\\/////\/\/\\\\\\\\///\/\\/\///\/
\///\//\\//\\\/\/\\\\\//\\\\\\//\/\\//\\\/\/\/////\/\//\/\//
/\\\\//\\\\/\\///\\\\/\\\/////\\\\\\//\///\//\\////\//\/\\\/
/\\/\\\//\/\/\//\//\//\\\//\\\\\\\/\\\/\\\\/\\///\/\/\//\///
\\/\\/////\/\\\///\\\/\\/\//\/\/\/\\\//\\\\\\\\/////\\/\\/\/
//\\\\\\\\/\\/////\\/\\\\\///\/\\/\\\/\\//\\\\\\/\\/\\\/////
\\//\\\\/\\/\\///\///\/\\\/\/\/////\//\\//\/\/\/\/\/\/\\/\//
\//\\\\\\///\/\\/\\\\/\\\/\/\/\/\//\////\/////\\\/\/\\/\\\\/
//\\\/\\//\\/\\/\/\\////\/\\//\/\/\///\//////\\///////\/\\//
\/\////\/\//\\\\//\\/\\/\\\\/\/////\///\/\\/\///\\\\/\\\//\/
\///\\/\\/\\\\\\/\\\\\\\/\\\///\\\/\\///\\\\//\/\/\/\\//\/\\
/\\\////\/\//\/////\\///\\//\/\\\/\/\\\/\/\\\\\////\\/\\////
- schoen 8y agoThis is inspired by this classic BASIC program, which is the inspiration for a whole book: https://10print.org/ https://10print.org/ (Note that this version of the original is half the size of this Python adaptation!)
- schoen 8y agoAlso, I guess you didn't sign up for a code golf session, but this version is 11 bytes shorter: import random print(''.join(random.choice("/\\") for _ in "x"*9999)) I was surprised to discover that "import random\nrandom.choice", "import random as r\nrandom.choice", and "__import__("random").choice" are all exactly 27 bytes, so no byte count is saved by preferring any of these forms over another!