Created
October 30, 2012 18:30
-
-
Save saltavenger/3982086 to your computer and use it in GitHub Desktop.
scrabble 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def playGame(wordList): | |
""" | |
Allow the user to play an arbitrary number of hands. | |
1) Asks the user to input 'n' or 'r' or 'e'. | |
* If the user inputs 'n', let the user play a new (random) hand. | |
* If the user inputs 'r', let the user play the last hand again. | |
* If the user inputs 'e', exit the game. | |
* If the user inputs anything else, tell them their input was invalid. | |
2) When done playing the hand, repeat from step 1 | |
""" | |
hand = None | |
while hand == None or HAND_SIZE > 0: | |
play = raw_input ('Enter n to deal a new hand, r to replay the last hand, or e to end game:') | |
if play == 'n': | |
hand = dealHand(HAND_SIZE) | |
playHand(hand.copy(), wordList, HAND_SIZE) | |
elif play == 'r': | |
if hand == None: | |
print 'You have not played a hand yet. Please play a new hand first!' | |
else: | |
playHand(hand,copy(), wordList, HAND_SIZE) | |
elif play == 'e': | |
break | |
else: | |
print 'Invalid Command.' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment