From efec2d81335fed230cfd8f9973cc4331a09b45ed Mon Sep 17 00:00:00 2001
From: BellCodeEditor <bellcode_dev@bell.ai>
Date: Sun, 4 Sep 2022 19:10:19 +0800
Subject: [PATCH] save project

---
 snake.py | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/snake.py b/snake.py
index e88c37c..4ef6c31 100644
--- a/snake.py
+++ b/snake.py
@@ -53,8 +53,15 @@ while True:
         y -= 30
     else:
         y += 30
+    if x<0 or y<0 or y>450 or x>630:
+        exit()
+    if (x, y) in position:
+        exit()
+
+
     position.append((x, y))
 
+
     if x==apple_x and y==apple_y:
 
         apple_x=random.randint(0,21)*30
@@ -77,4 +84,11 @@ while True:
 
     # 刷新画面
     pygame.display.update()
-    FPSCLOCK.tick(3)
\ No newline at end of file
+    FPSCLOCK.tick(3)
+
+
+
+
+
+
+
--
libgit2 0.25.0