Guest User

play_hand

a guest
Apr 29th, 2012
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1.  
  2. def play_hand(hand, word_list,score = 0):
  3. display_hand(hand)
  4.  
  5. count = element_counter(hand)
  6. if count == 0:
  7. print "Final Score", score
  8. return None
  9.  
  10. word = raw_input("Enter a word or . to finish ")
  11. if word == "." :
  12. print "Final Score", score
  13. return None
  14.  
  15. validity = is_valid_word(word,hand,word_list)
  16. if validity == True:
  17. word_score = get_word_score(word, count)
  18. print "word score",word_score
  19. score = score +word_score
  20. print "score so far", score
  21. play_hand(hand,word_list,score)#"""I didn't update the hand coz the function "is_valid_word" already
  22. ## does it by reducing the value of the letter used by 1"""
  23. if validity == False:
  24. print "choose another word"
  25. play_hand(hand,word_list,score)
  26.  
  27. return None
Advertisement
Add Comment
Please, Sign In to add comment