Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- from time import sleep
- a = ['0']
- for i in range(1,40):
- a.append(' ')
- le = len(a)
- def pr(a):
- b = []
- a.reverse()
- b = list(a)
- a.reverse()
- print '[',
- for i in range(le):
- print a[i],
- print b[i],
- print ']'
- def nex(a):
- test = 1
- while True:
- check = 0
- for i in range(le):
- try:
- test = int(a[i])
- test = i
- check = 1
- break
- except ValueError:
- test = 1
- if check == 1:
- break
- lo = a.index(a[test])
- if lo == 0:
- a[0] = ' '
- a[randint(0,1)] = str(randint(0,9))
- elif lo == le-1:
- a[le-1] = ' '
- a[randint(le-2,le-1)] = str(randint(0,9))
- else:
- a[lo] = ' '
- a[randint(lo-1,lo+1)] = str(randint(0,9))
- while True:
- pr(a)
- nex(a)
- sleep(0.01)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement