def _buy_vowel(self): try: self._current_player.takes_money(Round.__VOWEL_COST) self._try_to_guess(Round.__GUESS_TYPE_BUY) except InvalidAmount: print(f'Você não tem dinheiro suficiente para comprar uma vogal') sleep(2) self._run_turn()
def _input_options_menu(self): try: option_action = self._menu.input_menu() option_action() except InvalidMenuOption as e: print(e) sleep(1) self._run_turn() return
def _try_to_guess(self, guess_type): self._print_turn_start_message() if guess_type == Round.__GUESS_TYPE_WHEEL: RoundCLI.print_letter_value_message(self._letter_value) try: guess = self._input_guess(guess_type) has_guessed_letter = self._check_guess(guess, guess_type) self._check_round(has_guessed_letter) except (InvalidLetter, HasGuessedLetterBefore) as error_message: print(error_message) sleep(1.5) self._try_to_guess(guess_type) except NothingLeftToGuess as error_message: print(error_message) sleep(1.5)
def _guess_word(self): self._print_turn_start_message() guess = input('Qual é a palavra? ') has_guessed_word = self._secret_word.check_word(guess) self._print_turn_start_message() sleep(1) if has_guessed_word: self._current_player.add_money(Round.__WORD_VALUE) print(f'Você chutou {self._secret_word.get_word()} e acertou!') sleep(2) print(f'Você ganhou R${Round.__WORD_VALUE:.2f}') sleep(2) self._check_round(has_guessed_word)
def print_end_turn_message(keep_playing): if keep_playing: print("Continue jogando") else: print("Não foi dessa vez.") sleep(2)
def print_earned_money_message(earned_money): print(f"Você ganhou R${earned_money:.2f}") sleep(0.5)
def print_guessed_correctly_message(letter_count, guess): print(f"Tem {letter_count} letras '{guess}'") sleep(0.5)
import helpers import atu try: while True: atu.measure_level() atu.maybe_act() helpers.sleep(minutes=0.1, print_=True) except KeyboardInterrupt: print("Exit ATU script")