Skip to main content


Good morning, currently reading a book called:

10 PRINT CHR$(205.5+RND(1)); : GOTO 10

The book's title and subject is the one liner that produces a maze on the Commodore 64 BASIC V2. In one of the chapters the books authors consider ports to other 8 bit systems, as well as modern scripting languages, using unicode characters. Here is their port to perl:

perl -e 'binmode STDOUT,"utf8";{print chr(9585.5+rand);redo}'

Got me inspired, here are my attempts for python (the second one cheats a bit, as it uses POSIX shell to format the script):

python3 -c 'import random;exec("while True:\n\tprint(chr(int(9585.5+random.random())),end=\"\");")'
printf "import random\nwhile True:\n\tprint(chr(int(9585.5+random.random())),end='')" | python3 -

and php (still no native unicode support, so have to build the 3 bytes for the utf-8 symbol one by one):

php -r 'while(1){echo chr(226),chr(149),chr(177.5+rand(0,1));}'

in reply to elrido

bash:

bash -c 'while true;do printf %b "\U$(printf %08x $((9585 + $RANDOM % 2)))";done'