diff options
Diffstat (limited to 'game.py')
-rw-r--r-- | game.py | 29 |
1 files changed, 26 insertions, 3 deletions
@@ -1,10 +1,11 @@ #!/usr/bin/env python -import user -import computer -import elements +from User import User +from computer import Computer +from elements import * import constants import utility +import random class Game: def __init__(self): @@ -67,3 +68,25 @@ class Game: for e in l: list.append(e.get_character()) return list + + def user_swap_letters(self, letters): + ''' Return the given list of Letters to the bag, and take + the same amount of letters from the bag. + + @param letters: the list of letters to put back. + @return: True if it is possible, otherwise False. + ''' + res = self.user.swap_letters(self.bag, letters) + return res + + def computer_swap_letters(self): + ''' Return the an amount of Letters to the bag, and take + the same amount of letters from the bag. + + @return: True if it is possible, otherwise False. + ''' + amount = random.randint(1, 7) + res = self.computer.swap_letters(self.bag, amount) + return res + + |