feat: Premier essai du script, ajout de consignes dans le readme.
This commit is contained in:
66
controleur_de_gaz.py
Normal file
66
controleur_de_gaz.py
Normal file
@@ -0,0 +1,66 @@
|
||||
from time import sleep
|
||||
from random import uniform as rand
|
||||
from colorama import init, Fore, Style
|
||||
|
||||
|
||||
init(autoreset=True)
|
||||
code_secret = "TCPTAR".lower()
|
||||
entree = ""
|
||||
|
||||
|
||||
sleep(rand(0.7, 1.7))
|
||||
print("Initialisation des capteurs")
|
||||
sleep(rand(0.7, 1.7))
|
||||
print("Analyse des niveaux de gaz")
|
||||
sleep(rand(0.7, 1.7))
|
||||
|
||||
print("Détection de gaz toxiques", end="", flush=True)
|
||||
for i in range(0, 101, 4):
|
||||
bar = "#" * (i // 4) # remplit la barre selon le pourcentage
|
||||
print(f"\rDétection de gaz toxiques : [{bar:<25}] {i}%", end="", flush=True)
|
||||
sleep(rand(0.1, 0.3))
|
||||
|
||||
print(
|
||||
"\r"
|
||||
+ Fore.RED
|
||||
+ Style.BRIGHT
|
||||
+ "Détection de gaz toxiques : Confirmé "
|
||||
)
|
||||
sleep(rand(0.7, 1.7))
|
||||
print("Condition des valves : Ouverte")
|
||||
sleep(rand(0.7, 1.7))
|
||||
print("Procédure de sécurité activée")
|
||||
sleep(rand(0.7, 1.7))
|
||||
print(Style.BRIGHT + "FERMETURE AUTOMATIQUE DES PORTES")
|
||||
sleep(rand(0.7, 1.7))
|
||||
|
||||
entree = input("Entrez le code d'accès pour fermeture des valves : ").strip().lower()
|
||||
while entree != code_secret:
|
||||
sleep(1)
|
||||
entree = input("Code invalide! Veillez reesayer : ").strip().lower()
|
||||
|
||||
print("Code validé")
|
||||
sleep(rand(0.7, 1.3))
|
||||
message = "Fermeture des valves"
|
||||
print(message, end="", flush=True)
|
||||
for _ in range(3):
|
||||
sleep(0.5)
|
||||
print(".", end="", flush=True)
|
||||
|
||||
sleep(rand(0.7, 1.7))
|
||||
print("\rFermeture des valves... Valves fermées")
|
||||
sleep(rand(0.7, 1.7))
|
||||
print("Détection de gaz toxiques", end="", flush=True)
|
||||
for i in range(0, 101, 4):
|
||||
bar = "#" * (i // 4) # remplit la barre selon le pourcentage
|
||||
print(f"\rDétection de gaz toxiques : [{bar:<25}] {i}%", end="", flush=True)
|
||||
sleep(rand(0.1, 0.3))
|
||||
|
||||
sleep(rand(0.7, 1.7))
|
||||
print(
|
||||
"\r"
|
||||
+ Fore.GREEN
|
||||
+ Style.BRIGHT
|
||||
+ "Détection de gaz toxiques : Néant "
|
||||
)
|
||||
sleep(5)
|
Reference in New Issue
Block a user