python -c 'import random; print "".join(random.choice(r"/\\") for i in range(80*24))'A single line of Basic sends readers into a labyrinth
21–30 of 91 posts
Re: A single line of Basic sends readers into a labyrinth
#22A version that works in bash: yes 'c=(╱ ╲);printf ${c[RANDOM%2]}'|bash Source and credit: http://stackoverflow.com/a/13612327
Re: A single line of Basic sends readers into a labyrinth
#23Just to be clear...it doesn't generate a labyrinth. It generates something that looks like a labyrinth, but isn't one. It's just random forward and backward slashes.
The device you're on doesn't generate text. It looks like text, but it's really just red, green and blue dots.
Re: A single line of Basic sends readers into a labyrinth
#24A version that works in bash: yes 'c=(╱ ╲);printf ${c[RANDOM%2]}'|bash Source and credit: http://stackoverflow.com/a/13612327
Ruby: echo 'loop do print ["\u2571","\u2572"].sample end'|ruby
echo 'loop do print ["\u2571","\u2572"].sample ; sleep 0.001 end'|ruby
Re: A single line of Basic sends readers into a labyrinth
#25A version that works in bash: yes 'c=(╱ ╲);printf ${c[RANDOM%2]}'|bash Source and credit: http://stackoverflow.com/a/13612327
A slight modification to make it generate mostly solvable mazes: `yes 'c=(┻ ┫);printf ${c[RANDOM%2]}'|bash`
|| __ # (2 pipes, one space, 2 bars)
seems to work pretty well, tooRe: A single line of Basic sends readers into a labyrinth
#26Can this book not be available in digital form? Amazon and MIT Press only list the hardcover edition. http://mitpress.mit.edu/books/10-print-chr2055rnd1-goto-10-0
The article links to the book's (free) download page: http://10print.org
Still, I would pay $9.99 for mobi or epub. PDF is inconvenient for the Kindle and the iPad. Converting with Calibre is a chore, and rarely yields good results.
Re: A single line of Basic sends readers into a labyrinth
#27A version that works in bash: yes 'c=(╱ ╲);printf ${c[RANDOM%2]}'|bash Source and credit: http://stackoverflow.com/a/13612327
Re: A single line of Basic sends readers into a labyrinth
#28The cool thing was that I forgot to write the bounds check to make sure the ant stayed inside the framebuffer! So the ant would happily trundle off-screen, encounter arbitrary bits that were in that memory, and would often eventually return back on the screen from a different location. Or sometimes (probably due to encountering zeros offscreen) it would run a lap around the edge of the screen and then veer back inward.
Langton's Ant: http://en.wikipedia.org/wiki/Langtons_ant
Re: A single line of Basic sends readers into a labyrinth
#29Re: A single line of Basic sends readers into a labyrinth
#30Earlier quoted context omitted.
Ruby: echo 'loop do print ["\u2571","\u2572"].sample end'|ruby
This makes it slower, so it's more pleasant to watch: echo 'loop do print ["\u2571","\u2572"].sample ; sleep 0.001 end'|ruby
ruby -e 'loop do print ["\u2571","\u2572"].sample ; sleep 0.001 end'