def game(): for repetition in range(9): player_input_function() if draw_game_restart_or_exit() == True: time_sleep(2) draw_check() break
def congratulations(): print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n") print( " " * 27 + " ___ _ _ _ _ _" ) print( " " * 27 + " / __\ ___ _ __ __ _ _ __ __ _ | |_ _ _ | | __ _ | |_ (_) ___ _ __ ___ / \ " ) print( " " * 27 + " / / / _ \ | '_ \ / _` || '__| / _` || __|| | | || | / _` || __|| | / _ \ | '_ \ / __| / / " ) print( " " * 27 + "/ /___ | (_) || | | || (_| || | | (_| || |_ | |_| || || (_| || |_ | || (_) || | | |\__ \ /\_/ " ) print( " " * 27 + "\____/ \___/ |_| |_| \__, ||_| \__,_| \__| \__,_||_| \__,_| \__||_| \___/ |_| |_||___/ \/ " ) print( " " * 27 + " |___/ " ) time_sleep(3) os_clear_function()
def writing_draw(): print("\n\n\n\n\n") print( " .=-.-. ,--.--------. .--.-. ,-,--. ,---. ,---. ,-.-. .=-.-. " ) print( " /==/_ / /==/, - , -\ /==/ / ,-.'- _\ .--.' \ _,..---._ .-.,.---. .--.' \ ,-..-.-./ \==\ /==/_ / " ) print( " |==|, | \==\.-. - ,-./ \==\ -\ /==/_ ,_.' \==\-/\ \ /==/, - \ /==/ ` \ \==\-/\ \ |, \=/\=|- |==| |==|, | " ) print( " |==| | `--`\==\- \ \==\- \ \==\ \ /==/-|_\ | |==| _ _\ |==|-, .=., | /==/-|_\ | |- |/ |/ , /==/ |==| | " ) print( " |==|- | \==\_ \ `--`-' \==\ -\ \==\, - \ |==| .=. | |==| '=' / \==\, - \ \, , _|==| /==/. / " ) print( " |==| ,| |==|- | _\==\ ,\ /==/ - ,| |==|,| | -| |==|- , .' /==/ - ,| | - - , |==| `--`-` " ) print( " |==|- | |==|, | /==/\/ _ | /==/- /\ - \ |==| '=' / |==|_ . ,'. /==/- /\ - \ \ , - /==/ .=. " ) print( " /==/. / /==/ -/ \==\ - , / \==\ _.\=\.-' |==|-, _`/ /==/ /\ , ) \==\ _.\=\.-' |- /\ /==/ :=; : " ) print( " `--`-` `--`--` `--`---' `--` `-.`.____.' `--`-`--`--' `--` `--` `--` `=` " ) time_sleep(3) os_clear_function()
def player_o_winning(): print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n") print(" " * 40 + " ____ _ _ _ ") print(" " * 40 + " / __ \ | | (_) | |") print(" " * 40 + "| | | | | |__ __ _ ___ __ __ _ _ __ | |") print(" " * 40 + "| | | | | '_ \ / _` | / __| \ \ /\ / / | | | '_ \ | |") print(" " * 40 + "| |__| | | | | | | (_| | \__ \ \ V V / | | | | | | |_|") print(" " * 40 + " \____/ |_| |_| \__,_| |___/ \_/\_/ |_| |_| |_| (_)") time_sleep(3) os_clear_function()
def user_inputs(): list_of_names = [] print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n") starting_input_1 = str(input("Please, the first player enter his/her name: ")) list_of_names.append(starting_input_1) os_clear_function() print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n") starting_input_2 = str(input("Please, the second player enter his/her name: ")) list_of_names.append(starting_input_2) os_clear_function() print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n") print(" " * 60 + "-" * len(list_of_names[0] + "-" * len(list_of_names[1] + "-" * 14))) print(" " * 60 + "{} = X and {} = O.".format(list_of_names[0], list_of_names[1])) print(" " * 60 + "-" * len(list_of_names[0] + "-" * len(list_of_names[1] + "-" * 14))) time_sleep(4) os_clear_function()
def restart_game(): os_clear_function() restart_screen() print("\n\n\n\n\n\n\n\n\n") restart = input(" " * 67 + "y / n:") while restart not in possible_player_inputs_for_restart: print("Invalid input. Please enter y or n (case sensitive).") restart = input("y / n: ") os_clear_function() if "y" in possible_player_inputs_for_restart: clear_game_for_restart() print_table() game() elif "n" in possible_player_inputs_for_restart: thanking() time_sleep(3) break
def user_manual(): print("\n\n\n\n\n\n\n") print("-" * 142) print(" " * 65 + "USER MANUAL:\n") print(" " * 50 + "1.You will play this game on a 3x3 board.\n") print(" " * 27 + "2.You have to choose the numbers between 1 and 9 to be able to enter a correct input.\n") print(" " * 15 + "3.The first player who enters his/her name will play with 'X' and the second player is going to play with 'O'.\n") print(" " * 63 + "Don\'t cheat! ;)\n") print(" " * 58 + "Good luck and have fun! :)") print("-" * 142) time_sleep(15) os_clear_function() print(" " * 54 + "This is how the game works.") print(" " * 48 + "The sectioning of the numbers look like this.") print("\n\n\n\n") table_example() time_sleep(7) os_clear_function()
def starting(): os_clear_function() print("\n\n\n\n\n\n\n\n\n\n\n\n") print( " " * 33 + " -----------------------------------------------------------------------------" ) print(" " * 33 + " ####### ####### #######") print( " " * 33 + " # # #### # ## #### # #### ######" ) print( " " * 33 + " # # # # # # # # # # # # # " ) print( " " * 33 + " # # # # # # # # # # ##### " ) print( " " * 33 + " # # # # ###### # # # # # " ) print( " " * 33 + " # # # # # # # # # # # # # " ) print( " " * 33 + " # # #### # # # #### # #### ######" ) print( " " * 33 + " -----------------------------------------------------------------------------\n" ) time_sleep(3) os_clear_function()
def thanking(): print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n") print( " " * 5 + " _____ _ _ __ _ _ _ _ __ " ) print( " " * 5 + "|_ _| | |_ __ _ _ _ | |__ _ _ ___ _ _ / _| ___ _ _ _ __ | | __ _ _ _ (_) _ _ __ _ | | (_) \ \ " ) print( " " * 5 + " | | | ' \ / _` | | ' \ | / / | || | / _ \ | || | | _| / _ \ | '_| | '_ \ | | / _` | | || | | | | ' \ / _` | |_| _ | |" ) print( " " * 5 + " |_| |_||_| \__,_| |_||_| |_\_\ \_, | \___/ \_,_| |_| \___/ |_| | .__/ |_| \__,_| \_, | |_| |_||_| \__, | (_) (_) | |" ) print( " " * 5 + " |__/ |_| |__/ |___/ /_/ " ) time_sleep(4) os_clear_function()
def made_by(): print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n") print( " " * 11 + " __ __ _ _ ______ _ _ __ __ _ " ) print( " " * 11 + "| \/ | | | | | _ |___ / | | (_) ___ | \/ | | | " ) print( " " * 11 + "| \ / | __ _ __| | ___ | |__ _ _ (_) / / ___ | | _ ( _ ) | \ / | __ _ | |_ ___ " ) print( " " * 11 + "| |\/| | / _` | / _` | / _ \ | '_ \ | | | | / / / _ \ | | | | / _ \/\ | |\/| | / _` | | __| / _ \ " ) print( " " * 11 + "| | | | | (_| | | (_| | | __/ | |_) | | |_| | _ / /__ | (_) | | | | | | (_> < | | | | | (_| | | |_ | __/" ) print( " " * 11 + "|_| |_| \__,_| \__,_| \___| |_.__/ \__, | (_) /_____| \___/ |_| |_| \___/\/ |_| |_| \__,_| \__| \___|" ) print( " " * 11 + " __/ | " ) print( " " * 11 + " |___/ " ) time_sleep(3) os_clear_function()
def restart_screen(): print("\n\n\n") print( " " * 6 + " _ _ _ _ _ _ _ _ _ _ ___ " ) print( " " * 6 + " | | | | | | | | | |(_)| | | | | | | | |__ \ " ) print( " " * 6 + " | | | | ___ _ _ | | __| | _ _ ___ _ _ | | _ | | __ ___ | |_ ___ _ __ ___ ___ | |_ __ _ _ __ | |_ ) |" ) print( " " * 6 + " | |/\| | / _ \ | | | || | / _` | | | | | / _ \ | | | | | || || |/ / / _ \ | __| / _ \ | '__| / _ \/ __|| __| / _` || '__|| __| / / " ) print( " " * 6 + " \ /\ /| (_) || |_| || || (_| | | |_| || (_) || |_| | | || || < | __/ | |_ | (_) | | | | __/\__ \| |_ | (_| || | | |_ |_| " ) print( " " * 6 + " \/ \/ \___/ \__,_||_| \__,_| \__, | \___/ \__,_| |_||_||_|\_\ \___| \__| \___/ |_| \___||___/ \__| \__,_||_| \__| (_) " ) print( " " * 6 + " __/ | " ) print( " " * 6 + " |___/ " ) print("\n\n\n") print( " " * 25 + " ___ _ _ _ _ ___ " ) print( " " * 25 + "( _`\ ( )( ) ( )( ) _ /'___) " ) print( " " * 25 + "| |_) ) _ __ __ ___ ___ (_)(_) _ _ (_)(_) (_)| (__ _ _ __ ___ " ) print( " " * 25 + "| ,__/'( '__) /'__`\/',__)/',__) ( ) ( ) | || ,__) ( ) ( ) /'__`\/',__) " ) print( " " * 25 + "| | | | ( ___/\__, \\__, \ | (_) | | || | | (_) |( ___/\__, \ _ " ) print( " " * 25 + "(_) (_) `\____)(____/(____/ `\__, | (_)(_) `\__, |`\____)(____/(_)" ) print( " " * 25 + " ( )_| | ( )_| | " ) print( " " * 25 + " `\___/' `\___/' " ) print( " " * 25 + " ___ _ _ _ _ ___ " ) print( " " * 25 + "( _`\ ( )( ) ( )( ) _ /'___) " ) print( " " * 25 + "| |_) ) _ __ __ ___ ___ (_)(_) ___ (_)(_) (_)| (__ ___ _ " ) print( " " * 25 + "| ,__/'( '__) /'__`\/',__)/',__) /' _ `\ | || ,__) /' _ `\ /'_`\ " ) print( " " * 25 + "| | | | ( ___/\__, \\__, \ | ( ) | | || | | ( ) |( (_) ) _ " ) print( " " * 25 + "(_) (_) `\____)(____/(____/ (_) (_) (_)(_) (_) (_)`\___/'(_) " ) time_sleep(2)
def draw_game_restart_or_exit(): if len(list_of_player_inputs) == 9: time_sleep(2) os_clear_function() return True