def chk_kinds(self, num): print("1. 자동 2. 수동 3. 뒤로가기") choice = input(INPUT_TEXT) c2 = CommonFunc.values_chk(choice) if 0 < c2 < 4: if c2 == 1: for i in range(num): self.buy_auto() print("{}번째 {}".format(i + 1, self.user_lottos[self.l_index - 1])) self.money = CommonFunc.left_money(self.money, num * ONE_PRICE, False) print("남은 돈: {}".format(self.money)) self.again() elif c2 == 2: for i in range(num): self.buy_manual() print("{}번째 {}".format(i + 1, self.user_lottos[self.l_index - 1])) self.money = CommonFunc.left_money(self.money, num * ONE_PRICE, False) print("남은 돈: {}".format(self.money)) self.again() if c2 == 3: self.sub_menu() else: print("1~3 사이의 번호를 입력하세요.") self.chk_kinds(num)
def total_score(self): """점수 계산""" if self.rolls: self.rolls = [] self.scores = [] self.pin_maker() score = 0 roll_index = 0 for frame in range(TOTAL_FRAME): if self.is_strike(roll_index): if frame == LAST_FRAME: score += FULL_SCORE else: score += FULL_SCORE + self.rolls[ roll_index + 1][0] + self.rolls[roll_index + 1][1] elif self.is_spare(roll_index): if frame == LAST_FRAME: score += FULL_SCORE else: score += FULL_SCORE + self.rolls[roll_index + 1][0] else: score += self.rolls[roll_index][0] + self.rolls[roll_index][1] roll_index += 1 self.scores.append(score) if frame == LAST_FRAME: self.show_score(True) self.money = CommonFunc.left_money(self.money, MIN_MONEY, False) print("남은 돈: {}".format(self.money)) self.again()
def chk_rank(self, l_index, lst, is_b): ranks = [1658710563, 62592852, 1475065, 50000, 5000, 0] i = 0 if len(lst) == 6: print("축하합니다. 1등 당첨!!") print("당첨금: {}".format(ranks[i])) elif len(lst) == 5: if is_b: i += 1 print("축하합니다. 2등 당첨!!") print("당첨금: {}".format(ranks[i])) else: i += 2 print("축하합니다. 3등 당첨!!") print("당첨금: {}".format(ranks[i])) elif len(lst) == 4: i += 3 print("축하합니다. 4등 당첨!!") print("당첨금: {}".format(ranks[i])) elif len(lst) == 3: i += 4 print("축하합니다. 5등 당첨!!") print("당첨금: {}".format(ranks[i])) else: i += 5 if l_index in self.receipt_m: print("이미 수령한 로또입니다.") print("남은 돈: {}".format(self.money)) else: self.money = CommonFunc.left_money(self.money, ranks[i], True) print("남은 돈: {}".format(self.money))