diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 26d33521..00000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/.idea/Python-Projects.iml b/.idea/Python-Projects.iml deleted file mode 100644 index 07abf202..00000000 --- a/.idea/Python-Projects.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index dc64fad4..00000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2da..00000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index db8786c0..00000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index c1b104bb..00000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1ddf..00000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Dice_game/assets.py b/Dice_game/assets.py new file mode 100644 index 00000000..aee2dd3c --- /dev/null +++ b/Dice_game/assets.py @@ -0,0 +1,70 @@ +ASCII_ASSETS = { #ALL ASCII ASSETS + 1 : """ +----- +| | +| o | +| | +----- + """, + 2 : """ +----- +|o | +| | +| o| +----- + """, + 3: """ +----- +|o | +| o | +| o| +----- + """, + 4: """ + +----- +|o o| +| | +|o o| +----- + + """, + 5: """ +----- +|o o| +| o | +|o o| +----- + """, + 6: """ +----- +|o o| +|o o| +|o o| +----- + """, + "Menu_Image" : """ + _______ + /\ \ + /()\ () \ +/ \_______\ +\ /() / + \()/ () / + \/_____()/ + """, + "TextMenu": """ + _____ _____ _____ ______ _____ __ __ ______ + | __ \_ _/ ____| ____| / ____| /\ | \/ | ____| + | | | || || | | |__ | | __ / \ | \ / | |__ + | | | || || | | __| | | |_ | / /\ \ | |\/| | __| + | |__| || || |____| |____ | |__| |/ ____ \| | | | |____ + |_____/_____\_____|______| \_____/_/ \_\_| |_|______| + """, + "ready?" : """ +┌─────────? +│ ● ● │ +│ ready? │ +│ ● ● │ +└─────────? + """ +} diff --git a/Dice_game/game.py b/Dice_game/game.py new file mode 100644 index 00000000..007b2c1c --- /dev/null +++ b/Dice_game/game.py @@ -0,0 +1,66 @@ +from assets import ASCII_ASSETS +import os +import time +import random +#Simple function to clean all terminal and detects your OS +def clear_console(): + if os.name == "nt": + os.system("cls") + else: + os.system("clear") +#SECTION WHEN "TURNING DICE" AND GIVES A RESULT +def turning_and_result(predict:int): + clear_console() + print(ASCII_ASSETS["Menu_Image"]) + print("\n\nTurning...") + result = random.randint(1,6) + time.sleep(2) + clear_console() + print(ASCII_ASSETS[result]) + print(result) + print("\nRESULT!!!") + if result == predict: + print('\n\nYOU WON!!!') + else: + print('\n\nYOU LOST... :(') + print("\n\n ⚠ Redirecting to menu...") + time.sleep(4) + menu() +#SECTION WHEN CLIENT CHOISE A NUMBER +def Game_Step1(): + clear_console() + print(ASCII_ASSETS["ready?"]) + try: + input_number = int(input('Choise a number from 1 to 6\n\n> ')) + if input_number > 6 or input_number < 0: + clear_console() + print(" ⚠ That's not a number... redirecting to menu") + time.sleep(3) + menu() + turning_and_result(input_number) + except ValueError: + clear_console() + print(" ⚠ That's not a number... redirecting to menu") + time.sleep(3) + menu() + +#MENU SECTION +def menu(): + clear_console() + print(ASCII_ASSETS["TextMenu"]) + print(ASCII_ASSETS["Menu_Image"]) + input_menu = input('\nPress Enter to play or type "exit" to leave the game\n\n> ') + if input_menu == "": + Game_Step1() + elif input_menu == "exit": + exit() + + +if __name__ == '__main__': + try: + menu() + except KeyboardInterrupt: + clear_console() + print(" ⚠ Leaving the game...") + time.sleep(1) + exit() \ No newline at end of file