Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/game.py
diff options
context:
space:
mode:
Diffstat (limited to 'game.py')
-rw-r--r--game.py29
1 files changed, 26 insertions, 3 deletions
diff --git a/game.py b/game.py
index 87f40fb..ea515dd 100644
--- a/game.py
+++ b/game.py
@@ -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
+
+