Exemple #1
0
    def lastWordValid(self, data):
        words = data.split()
        result = findWord(words[-1])

        if result != 0 and result['is_a_word'] == True:
            return True

        return False
Exemple #2
0
    def lastWordValid(self, data):
        words = data.split()
        result = findWord(words[-1])

        if result != 0 and result['is_a_word'] == True:
            return True

        return False
Exemple #3
0
    def wordPossible(self, string):
        result = findWord(string)

        if result != 0:
            if (result['is_a_word'] == True and result['children'] > 0):
                return 'word_with_children'
            if (result['is_a_word'] == True and result['children'] == 0):
                return 'word_with_no_children'
            if (result['is_a_word'] == False and result['children'] > 0):
                return 'partial_word'

        return False;
Exemple #4
0
    def wordPossible(self, string):
        result = findWord(string)

        if result != 0:
            if (result['is_a_word'] == True and result['children'] > 0):
                return 'word_with_children'
            if (result['is_a_word'] == True and result['children'] == 0):
                return 'word_with_no_children'
            if (result['is_a_word'] == False and result['children'] > 0):
                return 'partial_word'

        return False
Exemple #5
0
def sequence(guess, board):
    seq = [guess[0]]  #Seq-Sequence set to first letter of guess
    count = 0  #Index of neighbors
    pos = 0  #Index of seq
    posBoard = 0  #Index of letter list on board
    found = 0  #If found, 1, if not, -1, else, 0
    boardDummy = board
    while compareWord(guess, seq) != 1 and found == 0:
        while compareWord(guess, seq) == -1 and found == 0:
            print seq, neighbors(seq, board, pos, posBoard)
            if count == len(neighbors(seq, board, pos, posBoard)):
                print "Not found"
                posBoard += 1
                count = 0
                board = boardDummy
            seq.insert(len(seq), neighbors(seq, board, pos, posBoard)[count])
            seq.pop(len(seq) - 2)
            count += 1
            if compareWord(guess, seq) == 0:
                board = fixBoard(seq, board, pos, posBoard)
                pos += 1
        while compareWord(guess, seq) == 0:
            count = 0
            posBoard = 0
            print seq, neighbors(seq, board, pos, posBoard)
            seq.insert(len(seq), neighbors(seq, board, pos, posBoard)[count])
            if compareWord(guess, seq) != -1:
                board = fixBoard(seq, board, pos, posBoard)
                pos += 1
            elif compareWord(guess, seq) == -1:
                break
    if compareWord(guess, seq) == 1:
        print "Found"
        word = ""
        for i in seq:
            word += i
        word = word.lower()
        if findWord.findWord(word):
            print "In dictionary"