Guest User

Play Hand

a guest
May 2nd, 2012
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. #
  2. # Problem #4: Playing a hand
  3. #
  4. def play_hand(hand, word_list):
  5.    
  6.     display_hand(hand)
  7.     word = str(raw_input("Enter a word or . to finish"))
  8.     score=0
  9.     if word == ".":
  10.         return score
  11.     validity = is_valid_word(word,hand,word_list)
  12.    
  13.     if validity == False:
  14.        
  15.         print "choose another word"
  16.         score += play_hand(hand,word_list)
  17.        
  18.     if validity == True:
  19.         word_score = get_word_score(word,HAND_SIZE)
  20.         print "word score",word_score
  21.         score = score + word_score
  22.         print "score",score
  23.         score += play_hand((update_hand(hand,word)),word_list)
  24.     return score
Advertisement
Add Comment
Please, Sign In to add comment