From af2db3246d11db53edfdae87c1f2a3338b309b03 Mon Sep 17 00:00:00 2001
From: BellCodeEditor <bellcode_dev@bell.ai>
Date: Sat, 26 Nov 2022 09:31:14 +0800
Subject: [PATCH] auto save

---
 snake.py | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/snake.py b/snake.py
index c946391..8a3c3d1 100644
--- a/snake.py
+++ b/snake.py
@@ -2,7 +2,7 @@ import pygame
 from pygame import locals
 import random
 pygame.init()
-screen = pygame.display.set_mode((1320,960))
+screen = pygame.display.set_mode((660,480))
 FPSCLOCK = pygame.time.Clock()
 background = pygame.image.load('bg.png')
 right = pygame.image.load('right.png')
@@ -11,7 +11,13 @@ body = pygame.image.load('body.png')
 left = pygame.image.load('left.png')
 up = pygame.image.load('up.png')
 down = pygame.image.load('down.png')
-z = pygame.font.Font('neuropol.ttf',18)
+a = pygame.font.Font('neuropol.ttf',18)
+b = pygame.font.Font('neuropol.ttf',18)
+c = pygame.font.Font('neuropol.ttf',18)
+d = pygame.font.Font('neuropol.ttf',18)
+e = pygame.font.Font('neuropol.ttf',18)
+f = pygame.font.Font('neuropol.ttf',18)
+g = pygame.font.Font('neuropol.ttf',18)
 x, y = 240, 120
 position = [(180, 90), (180, 120), (210, 120), (x, y)]
 setheading = "right"
@@ -48,33 +54,35 @@ while True:
         y += 30
     position.append((x, y))
     if x == a and y == b:
-        a = random.randint(0,43)
-        b = random.randint(0,31)
+        a = random.randint(0,21)
+        b = random.randint(0,15)
         a *= 30
         b *= 30
         score += 10
     elif x == c and y == d:
-        c = random.randint(0,43)
-        d = random.randint(0,31)
+        c = random.randint(0,21)
+        d = random.randint(0,15)
         c *= 30
         d *= 30
         score += 10
     else:
         position.pop(0)
-    if x < 0 or x > 1290 or y < 0 or y > 930:
+    if x < 0 or x > 630 or y < 0 or y > 450:
         print("Your score is:" + str(score))
         exit()
     screen.blit(background, (0, 0))
     screen.blit(background, (661, 0))
-    screen.blit(background, (0, 481))
-    screen.blit(background, (661, 481))
+    screen.blit(background, (1322, 0))
+    screen.blit(background, (0, 480))
+    screen.blit(background, (661, 480))
+    screen.blit(background, (1322, 480))
     screen.blit(snake_head, position[-1])
     for i in range(len(position)-1):
         screen.blit(body, position[i])
     screen.blit(food, (a,b))
     screen.blit(food, (c,d))
-    info = "Score:" + str(score)
-    text = z.render(info,True,(0,0,0))
+    a = "Score:" + str(score)
+    text = a.render(z,True,(0,255,255))
     screen.blit(text,(540,10))  
     pygame.display.update()
-    FPSCLOCK.tick(5)
\ No newline at end of file
+    FPSCLOCK.tick(score/10+3)
\ No newline at end of file
--
libgit2 0.25.0