Guest User

Untitled

a guest
Jun 24th, 2013
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.85 KB | None | 0 0
  1. def play_hand_r(hand, word_list):
  2.  
  3.     if calculate_handlen(hand) == 0:
  4.         print "All letters in hand used"
  5.         return 0
  6.     print "Current Hand:",
  7.     display_hand(hand)
  8.     word = raw_input('Enter word, or a "." to indicate that you are finished: ')
  9.     if word == ".":
  10.         print "User ended hand!"
  11.         return 0
  12.     elif is_valid_word(word,hand,word_list):
  13.         new_hand = update_hand(hand,word)
  14.         print '"' + word + '" earned', get_word_score(word,HAND_SIZE), "points"
  15.         print
  16.         score = get_word_score(word,HAND_SIZE) + play_hand_r(new_hand, word_list)
  17.         return score
  18.     else:
  19.         print "invalid entry try again" + "\n"*3
  20.         play_hand_r(hand, word_list)
  21.         return 0
  22.  
  23. def play_hand(hand, word_list):  
  24.     """
  25.    total = play_hand_r(hand, word_list)
  26.    print "the total score was", total
Advertisement
Add Comment
Please, Sign In to add comment