def suggestion(self, table): all_sets = Deck.allSets(table) set_difficulties = [] for the_set in all_sets: set_difficulties.append(self.get_difficulties(the_set)) time, index = self.get_time(set_difficulties) set_cards1, set_cards2, set_cards3 = all_sets[index] return time, (set_cards1, set_cards2, set_cards3)
def updateRatingsAI(self, table, setFound, the_time): '''AI was faster, so all sets involved are actually harder than we thought, ie increase their rating Please call whenever an AI finds a set ''' allSets = Deck.allSets(table) for the_set in allSets: try: self.ratingList[Deck.idOfSet(the_set)] += 50 except: self.ratingList[Deck.idOfSet(the_set)] = 1550 self.dumpData()
def updateRatingsHuman(self, table, setFound, the_time): '''updates the ratings of all sets involved in this round Please call whenever a human finds a set ''' initialRating = 1500 setFoundKey = Deck.idOfSet(setFound) try: setFoundRating = self.ratingList[setFoundKey] except KeyError: # first time this set shows up setFoundRating = initialRating losingSets = set(Deck.allSets(table)) - set(setFound) for the_set in losingSets: losingSetKey = Deck.idOfSet(the_set) try: losingSetRating = self.ratingList[losingSetKey] except KeyError: # first time this set shows up losingSetRating = initialRating newWinnerRating, newLoserRating = self.newRatings(setFoundRating, losingSetRating) self.ratingList[setFoundKey] = newWinnerRating self.ratingList[losingSetKey] = newLoserRating self.dumpData()