phillip1882

voters

Apr 6th, 2012
94
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import random,sys,os
  2.  
  3. def print_voters(votes):
  4.    os.system("CLS")
  5.    for i in range(0,30):
  6.       for j in range(0,30):
  7.          sys.stdout.write(str(votes[i*30+j]))
  8.       sys.stdout.write("\n")
  9. voters = []
  10. for i in range(0,900):
  11.    voters += [random.randint(0,1)]
  12.  
  13. print_voters(voters)
  14. i = 0
  15. result = True
  16. while result:
  17.    pos = random.randint(0,899)
  18.    bitx = random.randint(-1,1)
  19.    bity = random.randint(-1,1)
  20.    nieghbor = (pos/30+bity)*30 +pos%30+bitx
  21.    if nieghbor > 899:
  22.       nieghbor = nieghbor-899
  23.    try:
  24.       voters[pos] = voters[nieghbor]
  25.    except IndexError:
  26.       print(nieghbor)
  27.    i += 1
  28.    if i == 30:
  29.       print_voters(voters)
  30.       i -= 30
  31.       result = False
  32.       check = voters[0]
  33.       for i in range(1,899):
  34.          if check != voters[i]:
  35.             result = True
  36.             break
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×