Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/computer.py
diff options
context:
space:
mode:
Diffstat (limited to 'computer.py')
-rwxr-xr-xcomputer.py78
1 files changed, 78 insertions, 0 deletions
diff --git a/computer.py b/computer.py
new file mode 100755
index 0000000..7a40006
--- /dev/null
+++ b/computer.py
@@ -0,0 +1,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 ......
+
+
+
+
+
+
+
+