Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. from random import randint
  2. import random
  3. import copy
  4. import queue
  5. class variable:
  6. def __init__(self, name):
  7. self.name = name
  8. self.word = None
  9. self.wordList = ['ADD', 'ADO','AGE', 'AGO', 'AID','AIL', 'AIM', 'AIR', 'AND',
  10. 'ANY', 'APE', 'APT', 'ARC', 'ARE', 'ARK', 'ARM', 'ART', 'ASH',
  11. 'ASK', 'AUK', 'AWE', 'AWL', 'AYE', 'BAD', 'BAG', 'BAN', 'BAT',
  12. 'BEE', 'BOA', 'EAR', 'EEL', 'EFT', 'FAR', 'FAT', 'FIT', 'LEE',
  13. 'OAF', 'RAT', 'TAR', 'TIE']
  14.  
  15. A1 = variable('A1')
  16. A2 = variable('A2')
  17. A3 = variable('A3')
  18.  
  19. D1 = variable('D1')
  20. D2 = variable('D2')
  21. D3 = variable('D3')
  22.  
  23. unassignedList = [A1, A2, A3, D1, D2, D3]
  24. assignedList = []
  25.  
  26. def removeWord(toRemove, Ulist):
  27. i = 0
  28. for next in Ulist:
  29. next.wordList.remove(toRemove)
  30.  
  31. def removeVar(Ulist, var):
  32. i = 0
  33. for steps in Ulist:
  34. if steps.name == var.name:
  35. Ulist.pop(i)
  36. i += 1
  37.  
  38. def checkVal(var, each, Alist):
  39. checkOk = True
  40. for next in Alist:
  41. if var.name[0] != next.name[0]:
  42. if not ((next.word != each) and (next.word[int(var.name[1]) - 1] == each[int(next.name[1]) - 1])):
  43. checkOk = False
  44. return checkOk
  45.  
  46. def ACC(Ulist,Alist):
  47. q = queue.Queue()
  48.  
  49. while queue:
  50. Xi,Xj = q.get()
  51. if RIV(Xi,Xj):
  52.  
  53.  
  54.  
  55. def RIV(xi,xj):
  56. removed = True
  57. for x in xi.wordlist:
  58. if xi.name[0] != xj.name[0]:
  59. if not ((xi.word != xj) and (xi.word[int(xj.name[1]) - 1] == xj[int(xi.name[1]) - 1])):
  60. xi.wordlist.remove(x)
  61. removed = True
  62. return removed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement