Learn To Code AGI-man

This commit is contained in:
Jason 2024-08-10 09:25:32 +09:00
parent 53b3b7fdfc
commit 23f87a0dea

View file

@ -1,47 +1,27 @@
import os
import time
YELLOW = '\033[93m'
BROWN = '\033[38;5;52m'
RESET = '\033[0m'
YELLOW, BROWN, RESET = '\033[93m', '\033[38;5;52m', '\033[0m'
def garden(sub_stage=0):
frame = [
" ",
" ",
" ",
" ",
f"{BROWN}~~~~~~~~~~~~~~~~{RESET}",
f"{BROWN}################{RESET}",
f"{BROWN}################{RESET}",
f"{BROWN}################{RESET}",
f"{BROWN}################{RESET}",
f"{BROWN}################{RESET}"
]
def garden(stage):
flower = f" {YELLOW}(q*){RESET} "
soil = f"{BROWN}{'#' * 16}{RESET}"
frames = [" "] * 4 + [f"{BROWN}{'~' * 16}{RESET}"] + [soil] * 5
if stage < 5:
frames[stage] = flower
else:
frames[5 + (stage - 5)] = f"{BROWN}######{YELLOW}(q*){BROWN}######{RESET}"
return "\n".join(frames)
if sub_stage < 4:
frame[sub_stage] = f" {YELLOW}(q*){RESET} "
elif sub_stage == 4:
frame[4] = f"{BROWN}~~~~~~{YELLOW}(q*){BROWN}~~~~~~{RESET}"
elif sub_stage == 5:
frame[5] = f"{BROWN}######{YELLOW}(q*){BROWN}######{RESET}"
elif sub_stage == 6:
frame[6] = f"{BROWN}######{YELLOW}(q*){BROWN}######{RESET}"
elif sub_stage == 7:
frame[7] = f"{BROWN}######{YELLOW}(q*){BROWN}######{RESET}"
return "\n".join(frame)
def delicious():
while True:
for i in range(8):
os.system('cls' if os.name == 'nt' else 'clear')
print(garden(i))
time.sleep(0.5)
time.sleep(1)
if __name__ == "__main__":
def animate():
try:
delicious()
while True:
for i in range(10): # Increased to 10 stages
os.system('cls' if os.name == 'nt' else 'clear')
print(garden(i))
time.sleep(0.5)
except KeyboardInterrupt:
print("\nAnimation stopped.")
if __name__ == "__main__":
animate()