Hacker News new | ask | show | jobs
by zaf 3140 days ago
# Without unicode or pygame (using Python3)

  import sys, random
  while True :
    print( random.choice( [ chr( 92 ) , chr( 47 ) ] ) , end = "" )
    sys.stdout.flush( )
2 comments

  import random
  while True:
      print(random.choice("╱╲"), end="")
How's that for readability?
That's cool, didn't realize HN would allow that.
Here's a smaller one:

python3 -c 'while True: print(__import__("random").choice("╱╲"), end="")'

This one doesn't look correct in the terminal though as the characters don't join up

(parent):

  ╱╱╱╲╲╲╲╲╲╱╲╲╲╱╱╱╲╱╱╱╲╲╲
  ╱╱╲╲╲╲╲╲╲╲╱╱╲╲╲╱╲╲╱╱╲╲╲
vs (yours)

  \\\/\\\//\//\\///\\\\////\
  /\////\\\//\\\/\/\/\\\\/
Also in the terminal there isn't the space between the lines for the parent either (that's just HN formatting), but there is a space when using \ or /
The C64 font is (almost?) square, this also contributes to the nice effect.
It's square as it's 8x8 pixels, but the pixels themselves are not. There's a difference in aspect ratio between PAL and NTSC variants, and because the C64 was usually connected to a CRT, pretty much all bets are off.
That's because of HN formatting.
It's because u'\u2571' is a different character from chr(92)