def computer_level_choice(): os.system ('cls') user_choice_level = user_input ('Wybierz poziom trudnosci komputera:\nA - Sprytny komputer\nB - Mniej sprytny komputer\n', 'AB') if user_choice_level == 'A': os.system ('cls') print ('Wybrales SPRYTNY komputer.\n') if user_choice_level == 'B': os.system ('cls') print ('Wybrales MNIEJ SPRYTNY komputer.\n') return user_choice_level
def play(self): user_choice_welcome = user_input(self.first_screen, 'SPQ') os.system('cls') if user_choice_welcome == 'Q': print('Wybrales BRAK rozgrywki.') if user_choice_welcome == 'P': user_choice_level = computer_level_choice() if user_choice_welcome == 'S': os.system('cls') print( 'Brak mozliwosci wyboru poziomu trudnosci. Grasz ze SPRYTNYM komputerem.\n' ) while user_choice_welcome == 'S' or user_choice_welcome == 'P': user_choice = user_input(self.choice_screen, self.possible_choices) if user_choice_welcome == 'P': computer_choice = computer_random_choice( user_choice_level, self.possible_choices) if user_choice_welcome == 'S': computer_choice = random.choice(self.possible_choices) os.system('cls') print('Twoj wybor: ', user_choice) print('Wybor komputera: ', computer_choice) if check_choices(user_choice, computer_choice, self.remis, 'REMIS'): data.append('remis') if check_choices(user_choice, computer_choice, self.loss, ' Twoja PRZEGRANA'): data.append('P') if check_choices(user_choice, computer_choice, self.win, 'Twoja WYGRANA'): data.append('W') if game_over_YN(): break
def game_over_YN(): game_over_choice = 'NNNT' game_over = random.choice(game_over_choice) user_choice_continue = user_input('Czy chcesz grac dalej? T/N: ', 'TN') if user_choice_continue == 'N': if game_over == 'N': return True else: os.system('cls') print('Nie!? Tak łatwo mi się nie wymkniesz! Gramy dalej!') else: os.system('cls') return False
def game_over_YN(): game_over_choice = 'NNNT' game_over = random.choice (game_over_choice) user_choice_continue = user_input ('Czy chcesz grac dalej? T/N: ', 'TN') if user_choice_continue == 'N': if game_over == 'N': return True else: os.system('cls') print ('Nie!? Tak łatwo mi się nie wymkniesz! Gramy dalej!') else: os.system ('cls') return False
def play(self): user_choice_welcome = user_input(self.first_screen, 'SPQ') os.system ('cls') if user_choice_welcome == 'Q': print ('Wybrales BRAK rozgrywki.') if user_choice_welcome == 'P': user_choice_level = computer_level_choice() if user_choice_welcome == 'S': os.system ('cls') print ('Brak mozliwosci wyboru poziomu trudnosci. Grasz ze SPRYTNYM komputerem.\n') while user_choice_welcome == 'S' or user_choice_welcome == 'P': user_choice = user_input(self.choice_screen, self.possible_choices) if user_choice_welcome == 'P': computer_choice = computer_random_choice(user_choice_level, self.possible_choices) if user_choice_welcome == 'S': computer_choice = random.choice (self.possible_choices) os.system ('cls') print ('Twoj wybor: ', user_choice) print ('Wybor komputera: ', computer_choice) if check_choices(user_choice, computer_choice, self.remis, 'REMIS'): data.append('remis') if check_choices(user_choice, computer_choice, self.loss, ' Twoja PRZEGRANA'): data.append('P') if check_choices(user_choice, computer_choice, self.win, 'Twoja WYGRANA'): data.append('W') if game_over_YN(): break
'Twoja WYGRANA'): data.append('W') if game_over_YN(): break user_win = 0 user_loss = 0 data = [] os.system('cls') print('WITAJ W GRZE!\nW jaka gre chcesz zagrac?\n') user_choice_game = user_input( 'Wybierz:\n1 - KAMIEN-PAPIER-NOZYCZKI\n2 - KAMIEN-PAPIER-NOZYCZKI-LIZARD-SPOCK\nQ - wyjscie\n', '12Q') os.system('cls') if user_choice_game == 'Q': print('Wybrales BRAK rozgrywki.') #KAMIEN-PAPIER-NOZYCZKI if user_choice_game == '1': game = Game(first_screen='Wybrales KPN .......', possible_choices='KPN', choice_screen= 'Podaj swoj wybor: \nK - kamien \nP - papier \nN - nozyczki\n', remis=['KK', 'PP', 'NN'], win=['PK', 'NP', 'KN'], loss=['KP', 'PN', 'NK'])
data.append('P') if check_choices(user_choice, computer_choice, self.win, 'Twoja WYGRANA'): data.append('W') if game_over_YN(): break user_win = 0 user_loss = 0 data = [] os.system('cls') print('WITAJ W GRZE!\nW jaka gre chcesz zagrac?\n') user_choice_game = user_input ('Wybierz:\n1 - KAMIEN-PAPIER-NOZYCZKI\n2 - KAMIEN-PAPIER-NOZYCZKI-LIZARD-SPOCK\nQ - wyjscie\n', '12Q') os.system ('cls') if user_choice_game == 'Q': print ('Wybrales BRAK rozgrywki.') #KAMIEN-PAPIER-NOZYCZKI if user_choice_game == '1': game = Game( first_screen='Wybrales KPN .......', possible_choices='KPN', choice_screen = 'Podaj swoj wybor: \nK - kamien \nP - papier \nN - nozyczki\n', remis = ['KK', 'PP', 'NN'], win = ['PK', 'NP', 'KN'], loss = ['KP', 'PN', 'NK']
if user_choice_level == 'A': computer_choice = random.choice (options_available) if user_choice_level == 'B': double_element = random.choice(options_available) all_elements = double_element + options_available computer_choice = random.choice(all_elements) return computer_choice user_win = 0 user_loss = 0 data = [] os.system('cls') print('WITAJ W GRZE!\nW jaka gre chcesz zagrac?\n') user_choice_game = user_input ('Wybierz:\n1 - KAMIEN-PAPIER-NOZYCZKI\n2 - KAMIEN-PAPIER-NOZYCZKI-LIZARD-SPOCK\nQ - wyjscie\n', '12Q') os.system ('cls') if user_choice_game == 'Q': print ('Wybrales BRAK rozgrywki.') #KAMIEN-PAPIER-NOZYCZKI if user_choice_game == '1': user_choice_welcome = user_input ('Wybrales KAMIEN-PAPIER-NOZYCZKI. Co chcesz teraz zrobic?\nS - start gry \nP - wybierz poziom komputera \nQ - wyjscie\n', 'SPQ') os.system ('cls') if user_choice_welcome == 'Q': print ('Wybrales BRAK rozgrywki.') if user_choice_welcome == 'P': user_choice_level = computer_level_choice()