from ps3a import *
import time
from perm import *
#
#
# Problem #6A: Computer chooses a word
#
#
def comp_choose_word(hand, word_list, n):
high_score = 0
for length in range(1, n+1):
print 'Length:',length
for word in get_perms(hand, length):
print 'Trying',word
if get_word_score(word, n) > high_score:
print 'Found higher word',word
if is_valid_word(word, hand, word_list):
print word,'is valid'
high_score = get_word_score(word, n)
high_word = word
else:
print word,'is not valid english word'
print high_word,':',high_score
hand = {'a':1,'s':1,'t':2,'w':1,'f':1,'o':1}
#comp_choose_word(deal_hand(7), word_list, 7)
comp_choose_word(hand, word_list, 7)
print 'Fast for',get_word_score('fast', 7),'points'