Esempio n. 1
0
 def populate_bag(self):
     the_bag = Bag().get_bag()
     the_current_value = the_bag.pop(len(self.letters) // 2)
     self.insert(the_current_value)
     highest_index = len(the_bag) - 1
     for i in range(0, len(the_bag)):
         random_number = Random().randint(0, highest_index)
         the_current_value = the_bag.pop(random_number)
         self.insert(the_current_value)
         highest_index -= 1
Esempio n. 2
0
    def populate_bag(self):
        """Gets the letters from Bag as (letter,points,amount) then populates the tree and tries to get good spread by placing the middle first and then random"""
        the_bag = Bag().get_bag()
        the_current_value = the_bag.pop(len(self.letters) // 2)
        self.insert(the_current_value)
        highest_index = len(the_bag) - 1

        for i in range(0, len(the_bag)):
            random_number = Random().randint(0, highest_index)
            the_current_value = the_bag.pop(random_number)
            self.insert(the_current_value)
            highest_index -= 1