Advertisement
jackieradallhazik

Raphics

Nov 24th, 2015
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. from random import randint
  2. from time import sleep
  3. a = ['0']
  4.  
  5. for i in range(1,40):
  6.     a.append(' ')
  7. le = len(a)
  8. def pr(a):
  9.     b = []
  10.     a.reverse()
  11.     b = list(a)
  12.     a.reverse()
  13.     print '[',
  14.     for i in range(le):
  15.         print a[i],
  16.         print b[i],
  17.     print ']'
  18. def nex(a):
  19.     test = 1
  20.     while True:
  21.         check = 0
  22.         for i in range(le):
  23.             try:
  24.                 test = int(a[i])
  25.                 test = i
  26.                 check = 1
  27.                 break
  28.             except ValueError:
  29.                 test = 1
  30.         if check == 1:
  31.             break
  32.     lo = a.index(a[test])
  33.     if lo == 0:
  34.         a[0] = ' '
  35.         a[randint(0,1)] = str(randint(0,9))
  36.     elif lo == le-1:
  37.         a[le-1] = ' '
  38.         a[randint(le-2,le-1)] = str(randint(0,9))
  39.     else:
  40.         a[lo] = ' '
  41.         a[randint(lo-1,lo+1)] = str(randint(0,9))
  42. while True:
  43.     pr(a)
  44.     nex(a) 
  45.     sleep(0.01)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement