strawberry/strawberry.py

27 lines
794 B
Python
Raw Normal View History

2024-08-09 19:00:56 -05:00
import os
import time
2024-08-09 19:25:32 -05:00
YELLOW, BROWN, RESET = '\033[93m', '\033[38;5;52m', '\033[0m'
2024-08-09 19:00:56 -05:00
2024-08-09 19:25:32 -05:00
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)
2024-08-09 19:00:56 -05:00
2024-08-09 19:25:32 -05:00
def animate():
2024-08-09 19:00:56 -05:00
try:
2024-08-09 19:25:32 -05:00
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)
2024-08-09 19:00:56 -05:00
except KeyboardInterrupt:
print("\nAnimation stopped.")
2024-08-09 19:25:32 -05:00
if __name__ == "__main__":
animate()