blob: 7a400064de1865149945879c9ff85145779fe245 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
#!/usr/bin/env python
import elements
class Computer:
''' The Computer module represents the computer scrabble player
in the User vs Computer mode.
'''
def __init__(self, letters):
''' Initialize the Computer class.
@param letters: List of the Letters to use.
'''
self.__letters = letters
def get_letters(self):
''' Return the list of Letters.
@return: the list of elements.
'''
return self.__letters
def letters_length(self):
''' Return the length of the list of Letters.
@return: the number of elements.
'''
return len(self.__letters)
def get_letter_at(self, index):
''' Get the letter at the specified index of the list.
@param index: the index
@return: the Letter
'''
return self.__letter[index]
def add_letter(self, letter):
''' Add a new Letter to the list of Letters.
@param letter: the new Letter.
'''
self.__letters.append(letter)
def add_letter_from_bag(self, bag, amount = 0):
''' Add new Letters to the list of Letters.
@param bag: the bag which contains the Letters.
@amount: the amount.
'''
new_letters = bag.remove_letters(amount)
for letter in new_letters:
self.add_letter(letter)
def make_move(self, board, moves):
''' Function which calculates the move that the computer
will make.
@param board: the current gameboard
@param moves: the list of Moves that were made along the game.
'''
# calcular movimiento
# insertar en la tabla el movimiento
new_move = []
# implementar ......
|