From 79027390c958e025c0f07f0dcf2acf19f6902aa4 Mon Sep 17 00:00:00 2001 From: floraachy <1622042529@qq.com> Date: Thu, 4 Sep 2025 10:22:55 +0800 Subject: [PATCH] update lover --- .idea/HelloPython.iml | 8 ++++++ .../inspectionProfiles/profiles_settings.xml | 6 +++++ .idea/misc.xml | 7 +++++ .idea/modules.xml | 8 ++++++ .idea/vcs.xml | 6 +++++ main.py => game.py | 0 love.py | 26 +++++++++++++++++++ lover.py | 24 +++++++++++++++++ 8 files changed, 85 insertions(+) create mode 100644 .idea/HelloPython.iml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml rename main.py => game.py (100%) create mode 100644 love.py create mode 100644 lover.py diff --git a/.idea/HelloPython.iml b/.idea/HelloPython.iml new file mode 100644 index 0000000..f571432 --- /dev/null +++ b/.idea/HelloPython.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..f2396da --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..162110e --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/main.py b/game.py similarity index 100% rename from main.py rename to game.py diff --git a/love.py b/love.py new file mode 100644 index 0000000..7c31bc7 --- /dev/null +++ b/love.py @@ -0,0 +1,26 @@ +import turtle + +# 设置画布和画笔 +screen = turtle.Screen() +screen.bgcolor("white") + +pen = turtle.Turtle() +pen.color("red") +pen.fillcolor("red") +pen.speed(2) + +# 开始绘制爱心 +pen.begin_fill() +pen.left(140) +pen.forward(180) +pen.circle(-90, 200) +pen.setheading(60) +pen.circle(-90, 200) +pen.forward(180) +pen.end_fill() + +# 隐藏画笔 +pen.hideturtle() + +# 保持窗口打开 +turtle.done() diff --git a/lover.py b/lover.py new file mode 100644 index 0000000..b1357cb --- /dev/null +++ b/lover.py @@ -0,0 +1,24 @@ +import time + + +def lover(): + target = "♥" + for char in target.split(): + all_char = [] + for y in range(12, -12, -1): + lst = [] + lst_con = "" + for x in range(-30, 30): + formula = ((x * 0.05) ** 2 + (y * 0.1) ** 2 - 1) ** 3 - (x * 0.05) ** 2 * (y * 0.1) ** 3 + if formula <= 0: + lst_con += char[x % len(char)] + else: + lst_con += " " + lst.append(lst_con) + all_char += lst + time.sleep(1) + return "\n".join(all_char) + + +if __name__ == '__main__': + print(lover()) \ No newline at end of file