Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- import random
- import copy
- import queue
- class variable:
- def __init__(self, name):
- self.name = name
- self.word = None
- self.wordList = ['ADD', 'ADO','AGE', 'AGO', 'AID','AIL', 'AIM', 'AIR', 'AND',
- 'ANY', 'APE', 'APT', 'ARC', 'ARE', 'ARK', 'ARM', 'ART', 'ASH',
- 'ASK', 'AUK', 'AWE', 'AWL', 'AYE', 'BAD', 'BAG', 'BAN', 'BAT',
- 'BEE', 'BOA', 'EAR', 'EEL', 'EFT', 'FAR', 'FAT', 'FIT', 'LEE',
- 'OAF', 'RAT', 'TAR', 'TIE']
- A1 = variable('A1')
- A2 = variable('A2')
- A3 = variable('A3')
- D1 = variable('D1')
- D2 = variable('D2')
- D3 = variable('D3')
- unassignedList = [A1, A2, A3, D1, D2, D3]
- assignedList = []
- def removeWord(toRemove, Ulist):
- i = 0
- for next in Ulist:
- next.wordList.remove(toRemove)
- def removeVar(Ulist, var):
- i = 0
- for steps in Ulist:
- if steps.name == var.name:
- Ulist.pop(i)
- i += 1
- def checkVal(var, each, Alist):
- checkOk = True
- for next in Alist:
- if var.name[0] != next.name[0]:
- if not ((next.word != each) and (next.word[int(var.name[1]) - 1] == each[int(next.name[1]) - 1])):
- checkOk = False
- return checkOk
- def ACC(Ulist,Alist):
- q = queue.Queue()
- while queue:
- Xi,Xj = q.get()
- if RIV(Xi,Xj):
- def RIV(xi,xj):
- removed = True
- for x in xi.wordlist:
- if xi.name[0] != xj.name[0]:
- if not ((xi.word != xj) and (xi.word[int(xj.name[1]) - 1] == xj[int(xi.name[1]) - 1])):
- xi.wordlist.remove(x)
- removed = True
- return removed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement