diff options
Diffstat (limited to 'game.py')
-rw-r--r-- | game.py | 69 |
1 files changed, 69 insertions, 0 deletions
@@ -0,0 +1,69 @@ +#!/usr/bin/env python + +import user +import computer +import elements +import constants +import utility + +class Game: + def __init__(self): + self.board = Board() + self.bag = Bag() + self.dict = utility.get_dictionary() + self.user = User(self.bag) + self.computer = Computer(self.bag) + self.moves_log = [] + + + def get_user_letters(self): + ''' Return the list of user's Letters + + @return: the list of user's Letters. + ''' + return self.user.get_letters() + + def get_computer_letters(self): + ''' Return the list of computer's Letters + + @return: the list of computer's Letters. + ''' + return self.computer.get_letters() + + def get_user(self): + return self.user + + def get_computer(self): + return self.computer + + def computer_make_move(self): + return self.computer.make_move(self.board, + self.dict, + self.moves_log) + + + def get_user_char_letters(self): + ''' Return the list of user's letters, only the character + atribute of the Letter object. + + @return: the list of user's letters. + ''' + list = [] + l = self.user.get_letters() + for e in l: + list.append(e.get_character()) + return list + + + + def get_computer_char_letters(self): + ''' Return the list of user's letters, only the character + atribute of the Letter object. + + @return: the list of user's letters. + ''' + list = [] + l = self.computer.get_letters() + for e in l: + list.append(e.get_character()) + return list |