def score_check(self, category, dice, scorecard): #For current score current_score = Scorecard() current_score.scorecard = scorecard.scorecard.copy() current_score.Categories = copy.deepcopy(scorecard.Categories) current_score.Numbers = scorecard.Numbers.copy() current_score.record(category,dice) return current_score.scorecard[category]
def rest_check(self, dice, scorecard): #For remaining dice readings current_score = Scorecard() current_score.scorecard = scorecard.scorecard.copy() current_score.Categories = copy.deepcopy(scorecard.Categories) current_score.Numbers = scorecard.Numbers.copy() available_category = { "unos" : 0, "doses" : 0, "treses" : 0, "cuatros" : 0, "cincos" : 0, "seises" : 0, "pupusa de queso" : 0, "pupusa de frijol" : 0, "elote" : 0, "triple" : 0, "cuadruple" : 0, "quintupulo" : 0, "tamal" : 0 } check_possibilty = False for current_category in available_category: if current_category not in current_score.scorecard: current_score.record(current_category, dice) if available_category[current_category]==0: available_category[current_category] = current_score.scorecard[current_category] best_available_score = max(available_category.values()) #Checking for next best if len(available_category)>0: for my_index, label in available_category.items(): if label == best_available_score: return my_index if check_possibilty == False: return "null"