walloftext/redcode.py

25 lines
515 B
Python
Raw Normal View History

2015-07-03 22:37:20 +02:00
#!/usr/bin/env python3
2015-05-25 20:20:42 +02:00
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'
2015-07-03 22:37:20 +02:00
RESET='\033[0m'
2015-05-25 20:20:42 +02:00
colors = [ RED, GREEN, GREEN ]
2015-07-03 22:37:20 +02:00
try:
while True:
if randint(0,99) < 30:
stdout.write(choice(colors))
stdout.write('%X' % randint(0,15))
stdout.flush()
2015-12-29 18:09:34 +01:00
sleep(0.001)
2015-07-03 22:37:20 +02:00
except KeyboardInterrupt:
stdout.write(RESET+"\n")
stdout.flush()