public
Created

  • Download Gist
harlembits.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
import time
import random
 
bitrow = ["0"]*43
bits = [bitrow[:] for __ in range(10)]
# ^ Using [:] for copying the list, otherwise each row would be refering to the same list
 
delay = 0.425 # <- in seconds
 
def bitsprint(bits):
print "\n"*50
for row in bits:
print ''.join(row)
 
def randomize_bits(bits):
for rowindex, row in enumerate(bits):
for bitindex, __ in enumerate(row):
bits[rowindex][bitindex] = random.choice(["0","1"])
 
for i in range(32):
bits[4][22] = str(i%2)
bitsprint(bits)
time.sleep(delay)
 
for i in range(23):
randomize_bits(bits)
bitsprint(bits)
time.sleep(delay)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.