walloftext/redcode.py
2015-12-29 18:09:34 +01:00

24 lines
515 B
Python
Executable file

#!/usr/bin/env python3
from random import randint, choice
from sys import stdout
from time import sleep
RED='\033[31m'
GREEN='\033[32m'
YELLOW='\033[33m'
BLUE='\033[34m'
WHITE='\033[37m'
RESET='\033[0m'
colors = [ RED, GREEN, GREEN ]
try:
while True:
if randint(0,99) < 30:
stdout.write(choice(colors))
stdout.write('%X' % randint(0,15))
stdout.flush()
sleep(0.001)
except KeyboardInterrupt:
stdout.write(RESET+"\n")
stdout.flush()