From 9d5b7e1cdf237917cd58bbd38b59fdd19ed63cce Mon Sep 17 00:00:00 2001
From: BellCodeEditor <bellcode_dev@bell.ai>
Date: Sat, 27 Nov 2021 10:27:11 +0800
Subject: [PATCH] save project

---
 snake.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/snake.py b/snake.py
index e32eaed..9067d5f 100644
--- a/snake.py
+++ b/snake.py
@@ -62,9 +62,12 @@ while True:
         num2 = random.randint(1,16)
         apple_x = 30*num1-30
         apple_y = 30*num2-30
-        score +=1
+        score += 1
     else:
         position.pop(0)
+    #贪吃蛇是否撞墙
+    if x <0 or x > 630 or y < 0 or y > 450:
+        exit()
     # 将背景图画上去
     screen.blit(background, (0, 0))
     # 将贪吃蛇的头画上去
--
libgit2 0.25.0