import pygame
import random
import os

Dark_QUAN = (36, 99, 91)
White = (255, 255, 255)
Green = (152, 199, 147)
Green1 = (91, 161, 84)
FPS = 30
W = 734
H = 734

snake_SPEED = 10
snake_block = 10

class Snake (pygame.sprite.Sprite):
    def __init__(self):
        super().__init__()
        self.image = pygame.Surface((snake_block, snake_block))
        self.image.fill(Green1)
        self.rect = self.image.get_rect()
        self.rect.x = W / 2
        self.rect.y = H / 2
        self.body = 0
        self.lenght = 2
        self.score = 0
        self.dx = 0
        self.dy = 0

    def update(self):
        self.rect.x += self.dx
        self.rect.y += self.dy

        self.body.append([self.rect.x, self.rect.y])
        if len(self.body) > self.lenght:
            del self.body[0]
        for segm in self.body[:-1]:
            if segm[0] == self.rect.x and segm[1] == self.rect.y:
                return True
        return False
    def draw_body(self, surface):
        for segm in self.body[:-1]:
            pygame.draw.rect(surface, Green1, segm[0], segm[1],  snake_block, snake_block)

    def grow(self):
        self.lenght
        self.score


pygame.init()
pygame.mixer.init()
screen = pygame.display.set_mode((W, H))
Clock = pygame.time.Clock()

snake = Snake()

running = True
while running:
    Clock.tick(FPS)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False


    screen.fill((Green))
    pygame.display.update()


pygame.quit()