Scan to open on your phone
Point a camera at the QR code - it opens this exact paste, no app needed.
https://codepastes.com/zzgt37d5e1w2m26guntitledPlain Text
import turtle
import time
# --- Setup ---
screen = turtle.Screen()
screen.title("Worm Care Simulator")
screen.bgcolor("#f0f0f0")
screen.setup(width=600, height=400)
# The Worm
worm = turtle.Turtle()
worm.shape("circle")
worm.color("pink")
worm.shapesize(stretch_wid=2, stretch_len=5) # Makes it look "wormy"
worm.penup()
# Stats
stats = {"hunger": 50, "happiness": 50}
# Text Display
pen = turtle.Turtle()
pen.hideturtle()
pen.penup()
pen.goto(-250, 150)
def update_display():
pen.clear()
pen.write(f"Hunger: {stats['hunger']}% | Happiness: {stats['happiness']}%",
font=("Arial", 16, "bold"))
if stats['hunger'] >= 100:
pen.goto(-100, 0)
pen.write("The worm left to find snacks!", font=("Arial", 20, "bold"))
time.sleep(2)
turtle.bye()
# --- Actions ---
def feed():
if stats['hunger'] > 0:
stats['hunger'] -= 10
worm.shapesize(stretch_wid=2.5, stretch_len=5.5) # Grows slightly
time.sleep(0.1)
worm.shapesize(stretch_wid=2, stretch_len=5)
update_display()
def pet():
if stats['happiness'] < 100:
stats['happiness'] += 10
worm.sety(20) # A little hop of joy
time.sleep(0.1)
worm.sety(0)
update_display()
# --- Controls ---
screen.listen()
screen.onkey(feed, "f") # Press 'F' to feed
screen.onkey(pet, "p") # Press 'P' to pet
# --- Game Loop ---
update_display()
while stats['hunger'] < 100:
time.sleep(2) # Every 2 seconds, the worm gets hungrier
stats['hunger'] += 5
stats['happiness'] -= 2
update_display()
screen.update()
turtle.done()1,612 chars · codepastes.com